首先自定义view
+ (UIView *) changeViewTitleFontSize:(NSString *)strTitle;
{
//自定义标题
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0 , 100, 44)];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.font = [UIFont fontWithName: @"Helvetica" size: 14.0];
titleLabel.textColor = [UIColor whiteColor];//设置文本颜色
titleLabel.textAlignment = UITextAlignmentCenter;
titleLabel.text = strTitle;
return [titleLabel autorelease];
}
然后调用
self.navigationItem.titleView = [ABUtilchangeViewTitleFontSize:Localized(@"ModifyTheAlarmInformation")];