我想更改导航标题的字体和颜色。所以,我已经编写了下面的代码,但它没有生效...
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7")) {
NSDictionary *navbarTitleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
NSForegroundColorAttributeName,
[UIFont fontWithName:@"MyFavoriteFont" size:20.0],
NSFontAttributeName,
nil];
[[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes];
NSLog(@"setTitleTextAttributes");
}
为什么这段代码不起作用?