2016-03-21 6 views
0

Ich habe nach einer Möglichkeit gesucht, title font in navigationBar zu ändern und habe unten versucht, aber nichts passiert, die Schrift funktioniert gut auf UILabel und so weiter.Set NavigationBar title Schriftart

UINavigationBar.appearance().titleTextAttributes = [ 
    NSFontAttributeName: UIFont(name: "SourceSansPro-Regular", size: 18) ?? UIFont.systemFontOfSize(18) 
] 
+0

wo hast du diesen Code genau? – Wain

+0

in 'didFinishLaunchingWithOptions' –

+0

Sie Code für mich arbeiten. – iMuzahid

Antwort

0
[[UINavigationBar appearance] setTitleTextAttributes:@{ 
    UITextAttributeTextColor : [UIColor whiteColor], 
    UITextAttributeTextShadowColor : [UIColor blackColor], 
    UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake(1, 0)], 
    UITextAttributeFont : [UIFont fontWithName:@"System" size:25.0] 
}]; 

in schnellen

 UINavigationBar.appearance().titleTextAttributes = [UITextAttributeTextColor: UIColor.whiteColor(), 
    UITextAttributeTextShadowColor: UIColor.blackColor(), 
    UITextAttributeTextShadowOffset: NSValue(UIOffset: UIOffsetMake(1, 0)), 
UITextAttributeFont: UIFont(name: "System", size: 25.0)] 
+0

Das ist schnell .. –