在全屏modalView上显示NavigationBar

在全屏modalView上显示NavigationBar

本文介绍了iPhone-在全屏modalView上显示NavigationBar,使其向下滚动,顶部带有透明空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用调用的ModalView:

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];

它是这样初始化的:

- (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;
}

然后显示导航栏,但随后整个视图下降,并在视图顶部显示一个透明空间,其大小为状态栏的大小.与所有其他模拟元素一样,状态栏中的xib中的模拟元素也设置为OFF.
由于存在此空间,视图的底部内容不在屏幕之内.
设置navigationBarHidden = NO后,我尝试强制使用self.wantsFullScreenLayout = YES,但这并没有改变任何内容.

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.

有关信息,如果我这样更改viewDidLoad:

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.

可能是什么问题?

推荐答案

如,您可能需要在显示全屏视图控制器之前隐藏状态栏,例如直接在应用程序加载时显示.

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.

这篇关于iPhone-在全屏modalView上显示NavigationBar,使其向下滚动,顶部带有透明空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 13:25