我需要在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