我有一个应用程序,它具有用于正常交互的标签栏&导航栏。我的一个屏幕是文本的很大一部分,所以我允许用户点击去全屏(有点像Photos.app)。隐藏导航栏和标签栏时,UIView不会调整为全屏幕
导航栏&标签栏是隐藏的,我将文本视图的框架设置为全屏。问题是,标签栏曾经是空白的大约50px。你可以从这个截屏如果看到:
去除死ImageShack的链接
我不知道是什么导致了这一点。空格绝对不是文本视图背后的视图,因为我将它的背景颜色设置为红色以确保无误。什么可能导致这个?
**更新**
我做的一个UIWindow子类中的一些命中测试,结果发现,空白实际上是无证/未公布UILayoutContainerView。这是tabBar的父视图。我不认为建议直接操作这个视图,所以我怎样才能隐藏标签栏?
**更新#2 **
我检查self.view的框架&之前的动画之后,它看起来像父视图不调整不够。
进入全屏后,视图的帧只有411像素高。我试图手动搞乱框架,并设置autoResizeMask没有运气。
****更新:这是最终的结果****
- (void)toggleFullscreen {
isFullScreen = !isFullScreen; //ivar
//hide status bar & navigation bar
[[UIApplication sharedApplication] setStatusBarHidden:isFullScreen animated:YES];
[self.navigationController setNavigationBarHidden:isFullScreen animated:YES];
[UIView beginAnimations:@"fullscreen" context:nil];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:.3];
//move tab bar up/down
CGRect tabBarFrame = self.tabBarController.tabBar.frame;
int tabBarHeight = tabBarFrame.size.height;
int offset = isFullScreen ? tabBarHeight : -1 * tabBarHeight;
int tabBarY = tabBarFrame.origin.y + offset;
tabBarFrame.origin.y = tabBarY;
self.tabBarController.tabBar.frame = tabBarFrame;
//fade it in/out
self.tabBarController.tabBar.alpha = isFullScreen ? 0 : 1;
//resize webview to be full screen/normal
[webView removeFromSuperview];
if(isFullScreen) {
//previousTabBarView is an ivar to hang on to the original view...
previousTabBarView = self.tabBarController.view;
[self.tabBarController.view addSubview:webView];
webView.frame = [self getOrientationRect]; //checks orientation to provide the correct rect
} else {
[self.view addSubview:webView];
self.tabBarController.view = previousTabBarView;
}
[UIView commitAnimations];
}
(请注意,我切换到TextView的web视图,但原始文本视图相同的作品)
您的图像链接似乎已断开。如果您仍然有原始图像,请将其重新上传到stack.imgur,或者编辑您的问题以使其在没有图像的情况下工作。谢谢。 – 2015-07-27 14:41:27