我想知道在使用UINavigationController时如何更改视图标题的字体大小。
提前致谢
最佳答案
self.title = @"";
UILabel *myNavigationTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 5, self.view.frame.size.width, 33)];
myNavigationTitleLabel.textColor = [UIColor whiteColor];
myNavigationTitleLabel.backgroundColor = [UIColor clearColor];
myNavigationTitleLabel.text = @"my Custom title";
myNavigationTitleLabel.textAlignment = UITextAlignmentCenter;
myNavigationTitleLabel.font = [UIFont fontWithName:@"Arial" size:17];
[self.navigationController.navigationBar addSubview:myNavigationTitleLabel];
[myNavigationTitleLabel release];
请注意,如果您具有横向界面方向,则需要为myNavigationTitleLabel设置新框架。