美文网首页
TabBarItem

TabBarItem

作者: 葵安i | 来源:发表于2017-02-11 10:09 被阅读25次

这个是改变所有tabbar的设置文字颜色属性(appearance)

后面带有UI_APPEARANCE_SELECTOR的方法,都可以通过appearance对象来统一设置。

NSMutableDictionary*dis=[NSMutableDictionarydictionary];

dis[NSFontAttributeName]=[UIFontsystemFontOfSize:17];

dis[NSForegroundColorAttributeName]=[UIColorgrayColor];

UITabBarItem*Item=[UITabBarItemappearance];

[ItemsetTitleTextAttributes:disforState:0];

- (void)setTitleTextAttributes:(nullableNSDictionary *)attributes

forState:(UIControlState)stateNS_AVAILABLE_IOS(5_0)UI_APPEARANCE_SELECTOR;

arc4random_uniform

随机数

自定义的tabbar

UIButtonbutton与图片尺寸一样大

UIButton *but=[UIButton

buttonWithType:UIButtonTypeContactAdd];

[butsetBackgroundImage:@""forState:UIControlStateHighlighted];

but.frame=CGRectMake(0,0, but.currentBackgroundImage.size.width,but.currentBackgroundImage.size.height);

重写tabbar改写layoutsubviews方法(创建tabbar子类)

//kvc设置tabbar

//layoutSubviews, 当我们在某个类的内部调整子视图位置时,需要调用。


隐藏系统自带的tabbar

self.navigationController.hidesBottomBarWhenPushed= YES;

- (void)viewWillAppear:(BOOL)animated

{

[superviewWillAppear:animated];

self.tabBarController.tabBar.hidden=YES;

}

相关文章

网友评论

      本文标题:TabBarItem

      本文链接:https://www.haomeiwen.com/subject/llonittx.html