我需要在iPhone应用程序中更改一个视图控制器的导航栏标题文本的大小。我正在使用iOS5,并尝试了以下代码:导航栏标题字体大小
if ([self.tabBarItem respondsToSelector:@selector(setTitleTextAttributes:)]) {
NSLog(@"*** Support method(iOS 5): setTitleTextAttributes:");
[self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"AmericanTypewriter" size:20.0f], UITextAttributeFont,
[UIColor blackColor], UITextAttributeTextColor,
[UIColor grayColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)], UITextAttributeTextShadowOffset,
nil]];
}
但是,这仅适用于tabBarItem。
如果你只希望推看法有不同的字体?我希望我的根视图具有标准字体大小,但推送的视图要有较小的字体。我已经将它设置为较小的字体,但是当我回到根视图时,当我希望它成为标准尺寸时,字体仍然很小。 – 2012-10-31 21:24:28