TabBarItem


这个是改变所有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;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容