iPhone - 在全屏模态视图上显示导航栏使其下降,顶部透明空间
我有一个名为 ModalView :
PreferencesController *nextWindow = [[[PreferencesController alloc] initWithNibName:@"Preferences" bundle:nil] autorelease];
nextWindow.wantsFullScreenLayout = YES;
UINavigationController* navController = [[[UINavigationController alloc] initWithRootViewController:nextWindow] autorelease];
[self presentModalViewController:navController animated:YES];
它的初始化如下:
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBarHidden = YES;
self.title = @"Options";
}
当我设置时,单击按钮(用于测试):
- (IBAction)ClickIt:(id)sender {
self.navigationController.navigationBarHidden = NO;
}
然后显示导航栏,但随后整个视图下降,视图顶部有一个透明空间,具有状态栏的大小。与所有其他模拟元素一样,状态栏 xib 中的模拟元素设置为“关闭”。
由于这个空间,视图的底部内容超出了屏幕。
我尝试在设置 navigationBarHidden = NO
后强制 self.wantsFullScreenLayout = YES
但这不会改变任何内容。
有关信息,如果我像这样更改 viewDidLoad :
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBarHidden = NO;
self.title = @"Options";
}
那么问题是相同的,而不必单击测试按钮。
可能是什么问题?
I have a ModalView called with :
PreferencesController *nextWindow = [[[PreferencesController alloc] initWithNibName:@"Preferences" bundle:nil] autorelease];
nextWindow.wantsFullScreenLayout = YES;
UINavigationController* navController = [[[UINavigationController alloc] initWithRootViewController:nextWindow] autorelease];
[self presentModalViewController:navController animated:YES];
It is initialised like this :
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBarHidden = YES;
self.title = @"Options";
}
When I set, on a button click (for test) :
- (IBAction)ClickIt:(id)sender {
self.navigationController.navigationBarHidden = NO;
}
Then the navigtion bar is displayed, but then the whole view goes down with a transparent space on the Top of the view, with a size of a status bar. The simulated elements in the xibs for the status bar are set to OFF, as for all the other simulated elements.
Due to this space, the bottom content of the view goes out of screen.
I tried to force self.wantsFullScreenLayout = YES
after having set navigationBarHidden = NO
but that does not change anything.
For information, if I change viewDidLoad like this :
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBarHidden = NO;
self.title = @"Options";
}
Then the problem is the same without having to click the test button.
What could be the problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如中所示问题 您可能需要在显示全屏视图控制器之前隐藏状态栏,例如直接在应用程序加载时隐藏状态栏。
As indicated in this question you might need to hide the statusbar before presenting your full screen view controller, for instance directly on application load.