if (@available(iOS 13.0, *)) {
UITabBarAppearance *appearance = [UITabBarAppearance new];
// 修改tabbar顶部分割线的颜色
appearance.shadowColor = kColor_F2F2F2;
appearance.backgroundColor = [UIColor whiteColor];
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
style.alignment = NSTextAlignmentCenter;
UITabBarItemStateAppearance *normalAppearance = appearance.stackedLayoutAppearance.normal;
normalAppearance.titleTextAttributes = @{NSForegroundColorAttributeName:kColor_999999, NSParagraphStyleAttributeName: style};
// 修改文字到图片的距离
normalAppearance.titlePositionAdjustment = UIOffsetMake(0, -4);
UITabBarItemStateAppearance *selectedAppearance = appearance.stackedLayoutAppearance.selected;
selectedAppearance.titleTextAttributes = @{NSForegroundColorAttributeName:kColor_FFCB12, NSParagraphStyleAttributeName: style};
selectedAppearance.titlePositionAdjustment = UIOffsetMake(0, -4);
self.tabBar.standardAppearance = appearance;
}
iOS13修改tabbar的顶部分割线颜色、选中的item图片及颜色
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 美工设计的TabBar顶部分割线的颜色比iOS系统自带的颜色要浅很多,所以需要修改系统tabBar的颜色. 网上搜...
- 修改或删除UITabbar顶部线的颜色1.setBackgroundImage // 背景颜色2.setShado...
- 注意要同时设置setBackgroundImage和setShadowImage才有效果