这是代码,这将显示默认大小,我想更改标题的字体大小,因为这个标题太大 n 没有显示全部,只显示“Cook Great Indian...”...请让我帮忙
- (void)viewDidLoad {
self.title = @"Cook Great Indian Recipes";
}
最佳答案
尝试为标题标签设置自定义标签:
self.title = @"Cook Great Indian Recipes";
CGRect frame = CGRectMake(0, 0, [self.title sizeWithFont:[UIFont boldSystemFontOfSize:20.0]].width, 44);
UILabel *label = [[UILabel alloc] initWithFrame:frame];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:17.0];
label.textAlignment = UITextAlignmentCenter;
self.navigationItem.titleView = label;
label.text = self.title;
[label release];
关于iphone - 如何更改 iphone 中标题的字体大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7103708/