现在在iOS 11中,sizeThatFits不从UINavigationBar子类调用该方法.更改UINavigationBar导致故障和错误插入的框架.那么,现在如何定制导航栏高度的任何想法?
我正在开发一个应用程序,我刚刚升级到Xcode 9/Swift 4,并且还将我的iPhone升级到了iOS 11.当我安装iOS 11时安装了应用程序,所有看起来都没问题,直到我从Xcode运行它.现在我陷入了默认的NavBar高度.
我用来更改高度的代码不再有效:
class CustomNavControllerVC: UINavigationController
{
let navBarHeight : CGFloat = 64.0
let navbarBackButtonColor = UIColor(red: 247/255, green: 179/255, blue: 20/255, alpha: 1)
override func viewDidLoad()
{
super.viewDidLoad()
print("CustomNavControllerVC > viewDidLoad")
}
override func viewDidLayoutSubviews()
{
print("CustomNavControllerVC > viewDidLayoutSubviews")
super.viewDidLayoutSubviews()
navigationBar.frame.size.height = navBarHeight
navigationBar.tintColor = navbarBackButtonColor
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
// In my VCs
override func viewDidLoad()
{
customizeNavBar()
}
func customizeNavBar()
{ …Run Code Online (Sandbox Code Playgroud)