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;
[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;
相关文章推荐
- eigen与matlab对应函数列表
- Oracle查看当前实例及版本、字符集
- 解决SQL上下键找历史命令
- MediaBrowserService 音乐播放项目
- 解决JavaScript数字精度丢失问题的方法
- 学习网址、书籍-android
- ORA-02021解决方法--dblink操作ddl
- 8款超绚丽的jQuery焦点图动画
- 解析Java线程编程中的线程安全与synchronized的使用
- HDU 新生赛 油菜花王国(并查集)
- 正确使用std::auto_ptr
- PHP gmdate() 函数
- 数据结构--Chapte3(栈和队列)
- mysql数据截取
- 序列化和反序列详解
- audio tinymix 使用
- HDU 3861 The King’s Problem 缩点+二分匹配
- Cornerstone(SVN客户端) 创建分支 合并分支
- leetcode之Range Sum Query 2D - Immutable
- 切换界面时隐藏和显示状态栏