day2
2015-12-05 21:52
169 查看
class和string
[UITabBarButton class] == NSClassFromString(@"UITabBarButton") [UIButton class] == NSClassFromString(@"UIButton") @"UITabBarButton" == NSStringFromClass([UITabBarButton class])
如何设置UITabBar和UINavigationBar的内容
UITabBar的内容由UITabBarController所管理的子控制器的tabBarItem属性决定
UINavigationBar的内容
由UINavigationController所管理的子控制器的naivgationItem属性决定
设置导航栏标题文字
建议使用self.navigationItem.title取代self.title富文本
概念带有属性的文本
组成
文本(NSString *string)
属性(NSDictionary *attributes)
NSAttributedString
NSMutableDictionary *attrs = [NSMutableDictionary dictionary]; attrs[NSFontAttributeName] = [UIFont systemFontOfSize:13]; attrs[NSUnderlineStyleAttributeName] = @(NSUnderlineStyleSingle); label.attributedText = [[NSAttributedString alloc] initWithString:@"发帖子哈哈" attributes:attrs];
NSMutableAttributedString
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"发帖子哈哈哈"]; [string addAttributes:@{ NSForegroundColorAttributeName : [UIColor blueColor], NSBackgroundColorAttributeName : [UIColor yellowColor] } range:NSMakeRange(1, 2)]; [string addAttribute:NSUnderlineColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 6)]; [string setAttributes:@{ NSFontAttributeName : [UIFont systemFontOfSize:25] } range:NSMakeRange(1, 2)]; // addXXX : 可以给某个范围的文字无限追加属性 // setXXX : 只能给某个范围的文字设置一次属性,后面的设置会覆盖前面的设置
相关文章推荐
- HDU5592 排队问题 xingxing在努力
- 跨浏览器检测flash是否存在
- iOS解决tableView左边分割线有间距问题
- 10016---jQuery--CSS类
- python核心编程-lambda
- LightOJ 题目1079 Just another Robbery(01背包)
- BestCoder Round #65
- [Android] Service服务详解以及怎么使service服务不被杀死
- 实例详解Spring MVC入门使用
- day1
- perl 变量 $/ 的用法解析
- 有向图
- POJ 2083 Fractal (打表乱搞)
- Linux crontab 命令格式与详细例子
- URL Session(Cookie)
- static用法总结
- Android官方文档翻译 十 2.3Styling the Action Bar
- Java使用DOM解析XML
- VS常用快捷键
- Django 部署(Nginx)