【发布时间】:2013-07-06 18:14:06
【问题描述】:
我试图通过隐藏 UINavigationBar 和 UIStatusBar 来全屏显示视图(位于视图控制器视图顶部的 UIBubbleTable 实例)。但由于某种原因,黑色空间仍位于顶部:
NSLog(@"view frame before:%@", NSStringFromCGRect(self.view.frame));
NSLog(@"view bounds before:%@", NSStringFromCGRect(self.view.bounds));
NSLog(@"bubble table frame before:%@", NSStringFromCGRect(self.bubbleTable.frame));
NSLog(@"bubble table bounds before:%@", NSStringFromCGRect(self.bubbleTable.bounds));
[self.view hideKeyboard];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
self.navigationController.navigationBar.hidden = YES;
self.containerView.hidden = YES;
[self.view setFrame:[[UIScreen mainScreen] bounds]];
[self.bubbleTable setFrame:self.view.bounds];
NSLog(@"view frame after:%@", NSStringFromCGRect(self.view.frame));
NSLog(@"view bounds after:%@", NSStringFromCGRect(self.view.bounds));
NSLog(@"bubble table frame after:%@", NSStringFromCGRect(self.bubbleTable.frame));
NSLog(@"bubble table bounds after:%@", NSStringFromCGRect(self.bubbleTable.bounds));
NSLog:
2013-07-06 22:05:18.068 KIM[5085:c07] view frame before:{{0, 0}, {320, 504}}
2013-07-06 22:05:18.068 KIM[5085:c07] view bounds before:{{0, 0}, {320, 504}}
2013-07-06 22:05:18.069 KIM[5085:c07] bubble table frame before:{{0, 0}, {320, 248}}
2013-07-06 22:05:18.069 KIM[5085:c07] bubble table bounds before:{{0, 934}, {320, 248}}
2013-07-06 22:05:18.072 KIM[5085:c07] view frame after:{{0, 0}, {320, 568}}
2013-07-06 22:05:18.072 KIM[5085:c07] view bounds after:{{0, 0}, {320, 568}}
2013-07-06 22:05:18.072 KIM[5085:c07] bubble table frame after:{{0, 0}, {320, 568}}
2013-07-06 22:05:18.072 KIM[5085:c07] bubble table bounds after:{{0, 614}, {320, 568}}
它在模拟器上的外观:
为什么会发生这种情况,所有帧和边界似乎都是正确的 (0,0) ?怎么办?
【问题讨论】:
-
你试过重启xcode和模拟器吗?设备上是否也会发生同样的情况。我在一个干净的项目中尝试了你的代码,它完全没有黑线。
-
可能做产品->清洁
标签: iphone ios uitableview uiview fullscreen