navigation 设置自定义title

首先自定义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")];

posted @ 2014-01-08 11:11  暖流  阅读(401)  评论(0编辑  收藏  举报