IOS7 中的 UINavigationBar/状态栏问题 [英] UINavigationBar/Status Bar issue in IOS7

查看:18
本文介绍了IOS7 中的 UINavigationBar/状态栏问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最终编辑

(而不是有一个过长的问题进行编辑进行最终编辑以进行澄清,如果需要,请查看其他编辑).

控制器设置

我有一个设置如下的应用程序:

InitialViewController(

您是否看过UIBarPositioningDelegate":https://developer.apple.com/documentation/uikit/uibarpositioningdelegate

Final EDIT

(Rather than having an overly long question with edits making a final edit for clarification, please see other edits if needed).

Controller Setup

I have an application that is setup as follows:

InitialViewController (subclass of ECSlidingViewController)

Main Navigation Controller (subclass of UINavigationController)

Main Home View Controller (subclass of UIViewController)


In the viewDidLoad of the initialViewController I load the main navigation controller in with the Home View Controller as its root.

self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MainNavVC"];


The Issue

On the first load of the application the status bar and navigation bar are seperated.

This is the desired effect.

However, I then load a modal view controller and close it, using the standard methods:

[self performSegueWithIdentifier:@"LoadSelectOpponentVC" sender:self];

Then close with:

[self dismissViewControllerAnimated:YES completion:nil];

This in turn causes the main navigation controller (holding the home view controller) to display the status bar incorrectly and overlapping:

Testing

  1. The plist setting is set to YES - View controller-based status bar appearance
  2. I have tried setting the edgesForExtendedLayout to the relevant none, but no change.

Logging

I have tried to log out some frames to see where the issue occurs:

On first Load:

Main Nav VC - View Frame - {{0, 0}, {320, 480}}

Main Nav VC - Nav Bar Frame - {{0, 0}, {320, 44}}

Initial VC - View Frame - {{0, 0}, {320, 480}}

Home VC - View Frame - {{0, 0}, {320, 480}} -- viewDidLoad Home VC

Home VC - View Frame - {{0, 64}, {320, 416}} -- viewWillAppear Home VC

--- After Modal is opened/closed ----

Home VC - View Frame - {{0, 64}, {320, 416}} -- viewWillAppear Home VC

Main Nav VC - View Frame - {{0, 0}, {320, 480}} -- viewWillAppear Main Nav

Main Nav VC - Nav Bar Frame - {{0, 20}, {320, 44}} -- viewWillAppear Main Nav

Home VC - View Frame - {{0, 44}, {320, 436}} -- viewDidAppear Home VC

解决方案

Did you try Apple recommendation about "Preventing the Status Bar from Covering Your Views": https://developer.apple.com/library/content/qa/qa1797/_index.html

And did you have a look at "UIBarPositioningDelegate": https://developer.apple.com/documentation/uikit/uibarpositioningdelegate

这篇关于IOS7 中的 UINavigationBar/状态栏问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆