Error creating UINavigationBar in user class UINavigationController

I have a custom UINavigationController that I access from my storyboard, and I want to adjust the height of the navigation bar by creating a custom navigation bar. Here is what I still have:

var navBar = UINavigationBar(frame: CGRect(x: 0.0, y: 0.0, width: UIScreen.main().bounds.width, height: 70.0))
navBar.barTintColor = UIColor(red: 155.0/255.0, green: 155.0/255.0, blue: 155.0/255.0, alpha: 1.0)
super.init(navigationBarClass: navBar, toolbarClass: nil)

In the last line, I get this error

Cannot convert value of type 'UINavigationBar' to expected argument type 'AnyClass?'

Does anyone know why? It could be a mistake. I am using Xcode 8 beta and Swift 3

+4
source share
1 answer

super.init(navigationBarClass: (AnyClass). navBar, ( ) UINavigationBar, . :

super.init(navigationBarClass: UINavigationBar.self, toolbarClass: nil)

- : fooobar.com/questions/101233/...

+3

Source: https://habr.com/ru/post/1648797/


All Articles