iPhone - 在全屏模态视图上显示导航栏使其下降,顶部透明空间

发布于 2024-10-24 01:08:29 字数 1201 浏览 6 评论 0原文

我有一个名为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罪歌 2024-10-31 01:08:29

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文