问题
In UITabBarController, I am placing the tab bar on top of the screen using below code :
self.tabBar.frame = CGRectMake(0,0,UIScreen.mainScreen().bounds.width,50)
This works perfectly on iOS 10. But when the same app is installed on iOS11. It placing at the bottom only and not moving up.
Realy dont know what has changed in iOS11
But
How to move tabbar up for iOS 11
回答1:
After so much struggle figured out the solution.
I was placing the tabBar.frame code inside viewDidAppear which works for iOS 10 and below but to support for iOS 11, need to place inside viewDidLayoutSubviews as shown below which is actually the correct method :
override func viewDidLayoutSubviews()
{
tabBar.frame = CGRectMake(0,0,UIScreen.mainScreen().bounds.width,50)
}
来源:https://stackoverflow.com/questions/47328281/swift-placing-tabbar-on-top-of-the-screen-not-working-in-ios-11