iphone - 在 UITableViewController 中设置标题栏文本的字体和字体大小

标签 iphone objective-c

我有一个简单的基于导航的 iphone/objective-c 应用程序

在被插入 View 的各种 UIViewController 中,我可以使用类似的东西设置标题栏中的文本

self.title = @"blah blah blah"

有没有办法控制标题栏文本中标题的字体字体大小

谢谢!

最佳答案

调整导航 Controller 标题文本大小的正确方法是设置导航项的 titleView 属性

像这样(在 viewDidLoad 中)

   UILabel* tlabel=[[UILabel alloc] initWithFrame:CGRectMake(0,0, 300, 40)];
        tlabel.text=self.navigationItem.title;
    tlabel.textColor=[UIColor whiteColor];
    tlabel.backgroundColor =[UIColor clearColor];
    tlabel.adjustsFontSizeToFitWidth=YES;
    self.navigationItem.titleView=tlabel;

关于iphone - 在 UITableViewController 中设置标题栏文本的字体和字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1545975/

相关文章:

iphone - 在 CoreAnimation 期间重置 UIScrollView contentOffset

objective-c - 用单个对象替换多个数组内容?

objective-c - 属性和带有实例变量的属性有什么区别?

ios - 有没有办法将我的应用程序限制为 iPhone X 及更高版本?还是8及以上?

iphone - iOS 设备和蓝牙

iphone - 我如何刷新/重新加载以更新对我的谓词的更改并因此获取请求?

ios - AVAudioPlayer 停止在不同 View Controller 上播放的所有声音

objective-c - 如何测试 Objective-C 类以确定它是否响应静态选择器(类方法)?

iphone - beginBackgroundTaskWithExpirationHandler

iphone - 将 UIScrollView 与 UIView subview 连接起来