I need to change the size of the Navigation Bar title text for one view controller in my iPhone app. I\'m using iOS5, and tried the following code:
if ([self
Swift 2.0:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
UINavigationBar.appearance().titleTextAttributes = [
NSFontAttributeName: UIFont(name: "DINNextLTW04-Regular", size: 20)!
]
return true
}
Or
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBarHidden = false
self.title = "SAMPLE"
//Set Color
let attributes: AnyObject = [ NSForegroundColorAttributeName: UIColor.redColor()]
self.navigationController!.navigationBar.titleTextAttributes = attributes as? [String : AnyObject]
//Set Font Size
self.navigationController!.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "Arial", size: 37.0)!];
}