這個是改變所有tabbar的設(shè)置文字顏色屬性(appearance)
后面帶有UI_APPEARANCE_SELECTOR的方法荔茬,都可以通過appearance對象來統(tǒng)一設(shè)置。
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
隨機數(shù)
自定義的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方法(創(chuàng)建tabbar子類)
//kvc設(shè)置tabbar
//layoutSubviews, 當(dāng)我們在某個類的內(nèi)部調(diào)整子視圖位置時呐萌,需要調(diào)用。
隱藏系統(tǒng)自帶的tabbar
self.navigationController.hidesBottomBarWhenPushed= YES;
- (void)viewWillAppear:(BOOL)animated
{
[superviewWillAppear:animated];
self.tabBarController.tabBar.hidden=YES;
}