How to change the font and text color of the title of UINavigationBar
It seems this is needed as well:
self.navigationController?.navigationBar.barStyle = UIBarStyle.Black // I then set the color using:
self.navigationController?.navigationBar.barTintColor = UIColor(red: 204/255, green: 47/255, blue: 40/255, alpha: 1.0) // a lovely red
self.navigationController?.navigationBar.tintColor = UIColor.whiteColor() // for titles, buttons, etc.
let navigationTitleFont = UIFont(name: "Avenir", size: 20)!
self.navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: navigationTitleFont]
Change font of UINavigationController title
The title view can be any view. So just create a UILabel or something else where you change the font and assign that new view to the title property of the navigation item.
Setting UIBarButtonItem appearance resulted in weird behaviour with back button
I managed to fix the issue for solution 1, but honestly have no idea why I need both normal
and highlighted
state for it to work properly.
Need to add the following
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).setTitleTextAttributes(attributes, for: .highlighted)
Related Topics
What Is Container View in iOS 5 Sdk
Change App Language in iOS Without Restarting the App
How to Retrieve Messages Logged with Os_Log from iPad/Iphone
How to Use the Default iOS7 Uianimation Curve
A Server with the Specified Hostname Could Not Be Found
Why Is Swiftui Picker in Form Repositioning After Navigation
How to Convert a Kcvpixelformattype_420Ypcbcr8Biplanarfullrange Buffer to Uiimage in iOS
Becomefirstresponder Not Working in iOS 8
Uitableview Scrolls to Top When Reloading Cells with Changing Cell Heights
How to Disable Custom Keyboards (Ios8) for My App
Cannot Show Automatic Strong Passwords for App Bundleid
Keep Getting Error Messages When Compiling Newest Version of Admob on iOS6 Sdk
How to Use Coreaudio's Audioconverter to Encode Aac in Real-Time
App Crashes After Executing Background Fetch Completionhandler
How to Represent Core Data Optional Scalars (Bool/Int/Double/Float) in Swift
Check If an Auto-Renewable Subscription Is Still Valid
Is It Just the iPhone Simulator That Is Restricted to Intel Only MAC'S