My app requires the navigation bar to be more then usual size, to increase the size, I added the following class and assigned to navigation controller in story board
class CustomNavigationBar: UINavigationBar {
override func sizeThatFits(_ size: CGSize) -> CGSize {
return CGSize(width: UIScreen.main.bounds.width, height: 70)
}
override func awakeFromNib() {
let attribtutes = [
NSFontAttributeName: UIFont(name: "Montserrat-Light", size: 18)!,
NSForegroundColorAttributeName: UIColor.black,
NSKernAttributeName: 5.0
] as [String : Any]
UINavigationBar.appearance().titleTextAttributes = attribtutes
UINavigationBar.appearance().tintColor = UIColor.black
UINavigationBar.appearance().backgroundColor = UIColor.green
}
}
This does increase the size, however the navigation bar items are placed in the bottom. (refer the screenshot below)
What I am looking for is to center align the title and back button vertically. I also want to move the back button slightly to the right.
I tried multiple options but nothing seems to work. Any help on how to go about is appreciated.
Thanks.