IOS 学习

OC-UITabBar上相关设置

2019-03-27  本文已影响0人  SK丿希望
[UITabBar appearance].barStyle = UIBarStyleBlack;
CGRect rect = CGRectMake(0, 0, [UIApplication sharedApplication].keyWindow.bounds.size.width, 1);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[UITabBar appearance].shadowImage = image;
[UITabBar appearance].backgroundColor = hw_BGColor;
[UITabBar appearance].backgroundImage = [UIImage imageNamed:@"TabBar_BG"];
[UITabBarItem appearance].titlePositionAdjustment = UIOffsetMake(0.0,0.0);
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]} forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:self.normalColor} forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:self.selectColor} forState:UIControlStateSelected];

注意:有点设置无限需要将[UITabBar appearance].translucent = YES;才可以

self.navigationBar.barStyle = UIBaselineAdjustmentNone;
上一篇下一篇

猜你喜欢

热点阅读