暗黑模式 适配参考suiling的文章 ,
模态弹窗的状态栏透明,是由于modalPresentationStyle
默认是auto
,设置modalPresentationStyle
为需要的值可以解决,
tabbar
和navigationbar
的线隐藏失效,
CYLTabBarController
对tabbar
文字的颜色和字体失效,适配:
if (@available(iOS 13.0, *)) {
UITabBar *tabbar = [UITabBar appearance];
[tabbar setTintColor:[UIColor redColor]];
// 普通状态下的文字属性
NSMutableDictionary *normalAttrs = [NSMutableDictionary dictionary];
normalAttrs[NSFontAttributeName] = kFont(12, UIFontWeightRegular);
// set the text color for selected state
// 选中状态下的文字属性
NSMutableDictionary *selectedAttrs = [NSMutableDictionary dictionary];
selectedAttrs[NSFontAttributeName] = kFont(12, UIFontWeightRegular);
UITabBarItem *tabBarItem = [UITabBarItem appearance];
[tabBarItem setTitleTextAttributes:normalAttrs forState:UIControlStateNormal];
[tabBarItem setTitleTextAttributes:selectedAttrs forState:UIControlStateSelected];
} else {
// 普通状态下的文字属性
NSMutableDictionary *normalAttrs = [NSMutableDictionary dictionary];
normalAttrs[NSFontAttributeName] = kFont(12, UIFontWeightRegular);
// set the text color for selected state
// 选中状态下的文字属性
NSMutableDictionary *selectedAttrs = [NSMutableDictionary dictionary];
selectedAttrs[NSForegroundColorAttributeName] = [UIColor redColor];
selectedAttrs[NSFontAttributeName] = kFont(12, UIFontWeightRegular);
// set the text Attributes
// 设置文字属性
UITabBarItem *tabBarItem = [UITabBarItem appearance];
[tabBarItem setTitleTextAttributes:normalAttrs forState:UIControlStateNormal];
[tabBarItem setTitleTextAttributes:selectedAttrs forState:UIControlStateSelected];
}
UITextField
的leftView
直接设置UIButton、UIImageView
等直接渲染图片的控件时,控件大小会自动设置为图片大小,需要在外层添加一层UIView防止自适应
网友评论