定制UITabbar样式
来源:互联网 发布:u盘excel数据恢复 编辑:程序博客网 时间:2024/04/18 04:09
1、背景颜色
_tabbar.barTintColor = [UIColor blueColor];
2、顶部阴影线,新建UITabbar扩展类
- (void)layoutSubviews{ [super layoutSubviews]; if (self.shadowColor) { self.topLineView.backgroundColor = self.shadowColor; }}- (UIView *)topLineView{ UIView *view = nil; for (UIView *subview in self.subviews) { if (subview.top < 0 && [subview isKindOfClass:[UIImageView class]]) { view = subview; break; } } return view;}
3、选中项颜色
_tabbar.selectedImageTintColor = [UIColor redColor];
4、默认图标,使用原图
UIImage *selectedImage = [UIImage imageNamed:@"menu_home"]; UIImage *defaultImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; UITabBarItem *item1 = [[UITabBarItem alloc] initWithTitle:@"首页" image:defaultImage selectedImage:selectedImage];
5、标题样式修改,还可定制其他属性,参考NSAttributedString.h
+ (void)load{ NSDictionary *attributes = @{ NSForegroundColorAttributeName: [UIColor colorWithHexValue:0xaeaeae] }; [[UITabBarItem appearance] setTitleTextAttributes:attributes forState:UIControlStateNormal]; attributes = @{ NSForegroundColorAttributeName: [UIColor colorWithHexValue:0xff8eba] }; [[UITabBarItem appearance] setTitleTextAttributes:attributes forState:UIControlStateSelected];}
0 0
- 定制UITabBar显示样式
- 定制UITabbar样式
- UITabBar 和 UINavigationBar 样式的定制
- 定制 UItabbar
- UITabBar -- 定制
- UITabBar样式
- UITABBAR特殊样式设置
- IOS 定制中间突出UItabBar
- IOS 定制中间突出UItabBar
- UI定制第一季第一集:UITabBar
- 更改UITabBar的“更多”导航样式
- UITabBar
- UITabBar
- UITabBar
- UITabbar
- UITabBar
- UITabBar
- UITabBar
- Android 内存溢出解决方案(OOM)
- Java JDBC批处理插入数据操作(转)
- 线程属性总结(二)
- 不用翻墙就实现android SDK 更新方法
- Android:布局实例之常见用户设置界面
- 定制UITabbar样式
- 自定义控件实现imageview的点击效果
- 树莓派的gpio python使用
- Android启动过程深入解析
- HiWork发布1.7.0新版本——可开启频道公开链接,增加HiWork客服功能及集成应用麦客
- sublime汉化
- App Transport Security(ATS)
- mySQL学习
- 将32位代码向64位平台移植的注意事项