iOS 11 prefersLargeTitles Weird Transition

杀马特。学长 韩版系。学妹 提交于 2019-12-23 08:00:08

问题


So I'm having a weird issue with the new large titles in iOS 11. Instead of me trying to badly and confusingly explain the issue here is a 10-second screen recording of what is happening:

Screen recording of issue on YouTube

As you can see there is a weird black bar that appears when transitioning between a view controller that has

navigationItem.largeTitleDisplayMode = .never

And one that is set to .always

Thanks in advance!


回答1:


Before the transition set this:

self.navigationController?.view.backgroundColor = .white



回答2:


As Pranav said, the issue here is the background colour of the navigation controller's view, however changing that from a child view controller is not the perfect way to do it.

Instead, a better way is to subclass UINavigationController and in the viewDidLoad() set the

override func viewDidLoad()
{
  super.viewDidLoad()
  view.backgroundColor = .white
}

Then, just use your custom subclass rather than the standard UINavigationController. This way, you only ever need this code in one place.



来源:https://stackoverflow.com/questions/46217241/ios-11-preferslargetitles-weird-transition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!