Change UINavigationBar font properties?

前端 未结 7 433
清酒与你
清酒与你 2020-12-24 05:42

I have an UINavigationBar added to my UIViewController view. I want to change the fonts properties. Note that I want to change a UINavigationBar not controller. In my app wh

7条回答
  •  借酒劲吻你
    2020-12-24 05:53

    Just put this in your app delegate's

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    

    From Ray Wenderlich:

    http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5

    [[UINavigationBar appearance] setTitleTextAttributes:
    [NSDictionary dictionaryWithObjectsAndKeys:
    [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0], 
    UITextAttributeTextColor, 
    [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8], 
    UITextAttributeTextShadowColor, 
    [NSValue valueWithUIOffset:UIOffsetMake(0, -1)], 
    UITextAttributeTextShadowOffset, 
    [UIFont fontWithName:@"STHeitiSC-Light" size:0.0], 
    UITextAttributeFont, nil]];
    

提交回复
热议问题