navigation和tabbar上的文字.图片 自定义
[[UITabBarItem appearance] setTitleTextAttributes:@{ UITextAttributeTextColor : [UIColor blackColor],UITextAttributeFont:[UIFont fontWithName:@"Marion-Italic" size:14.0]} forState:UIControlStateNormal];
UIControState的设置:
UIControlStateNormal:未被选中时;
UIControlStateHighlighted:被选中的时候;
navigation和tabbar上的文字.图片
[self.navigationController.tabBarItem setTitlePositionAdjustment:UIOffsetMake(15, -10)];
uitabbaritem.imageInsets
// 导航底部线条颜色
[self.navigationController.navigationBar setBackgroundImage:[self imageWithColor:[UIColor clearColor]]
forBarPosition:UIBarPositionAny
barMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
// 去除tabbar顶部黑线
1.
CGRect rect = CGRectMake(0, 0, SCREEN_WIDTH, tabbarVC.view.frame.size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[tabbarVC.tabBar setBackgroundImage:img];
[tabbarVC.tabBar setShadowImage:img];
2.
tabbarVC.tabBar.barStyle = UIBarStyleBlack;
tabbarVC.tabBar.translucent = YES; // 这句话是加透明效果的。
// 返回一张纯色图片
- (UIImage *)imageWithColor:(UIColor *)color
{
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}