我试图通过隐藏 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));
NS日志:
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) ?该怎么办?