您的位置:首页 > 其它

NavigationItem.titleView custom自定义

2015-12-03 09:01 357 查看
NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc]initWithString:@"Cloud 2 Door"];

[titleString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:185/255.0 green:225/255.0 blue:238/255.0 alpha:1.0] range:NSMakeRange(0, 5)];

[titleString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(6, 6)];

UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 30)];

[customLab setTextColor:[UIColor blueColor]];

[customLab setAttributedText:titleString];

customLab.font = [UIFont boldSystemFontOfSize:24];

customLab.textAlignment = NSTextAlignmentCenter;

self.navigationController.navigationItem.titleView = customLab;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: