问题
Ever since Xcode 11 came out I have been trying to fix my app. There is something going on with the Status Bar + Navigation Bar and nothing I have been trying seems to be working and I can't seem to find any related issues either.
I have tried instantiating the Tab Bar Controller with less/more tabs. I tried changing the order. I tried using a navigation bar on the Tab Bar controller instead of the individual view controllers.
For some reason the first View Controller (root of a UINavigation Controller) in the Tab Bar Controller has no issues but when I change tabs, the navigation bar gets pushed up.
I added 2 screenshots to show what is going on. The first image shows the correct way the app is supposed to be and the second image shows the navigation bar being pushed into the status bar.
[UIView transitionFromView:self.window.rootViewController.view
toView:viewController.view
duration:0.55f
options: UIViewAnimationOptionTransitionCrossDissolve
completion:^(BOOL finished){
self.window.rootViewController = viewController;
}];
回答1:
I noticed a change with transitionFromView in IOS 13 thats different from IOS 12. To see if this is your issue, try setting self.window.rootViewController = viewController; without the transition code block, and see if you still have the problem.
self.window.rootViewController = viewController;
/*
[UIView transitionFromView:self.window.rootViewController.view
toView:viewController.view
duration:0.55f
options: UIViewAnimationOptionTransitionCrossDissolve
completion:^(BOOL finished){
self.window.rootViewController = viewController;
}];
*/
来源:https://stackoverflow.com/questions/58254034/xcode-11-uinavigationcontroller-bar-problems