1.原來的設(shè)置tabBarTitle選中及未選中狀態(tài)的顏色代碼失效
使用新代碼
if (@available(iOS 13.0, *)) {
UITabBarAppearance *appearance = UITabBarAppearance.new;
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
UITabBarItemStateAppearance *normal = appearance.stackedLayoutAppearance.normal;
UITabBarItemStateAppearance *selected = appearance.stackedLayoutAppearance.selected;
if (normal) {
normal.titleTextAttributes = @{NSForegroundColorAttributeName:k_TabbrTextColor,NSParagraphStyleAttributeName : paragraphStyle};
}
if (selected) {
selected.titleTextAttributes = @{NSForegroundColorAttributeName:k_TabbrSelectedTextColor,NSParagraphStyleAttributeName : paragraphStyle};
}
self.tabBar.standardAppearance = appearance;
}
2.原本設(shè)置cell的accessoryType
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
如果你不準備適配暗夜模式,只將cell的背景色統(tǒng)一設(shè)置,UITableViewCellAccessoryDisclosureIndicator同樣會將箭頭圖片的顏色進行修改,導致和cell背景色顏色相近。
解決辦法是使用accessoryView屬性,
self.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_arrowright_gray"]];