https://www.jianshu.com/p/2ac8dbdcc88f
UISearchBar 的页面crash
UISearchBar *searchView = [[UISearchBar alloc]init];
NSString *version = [UIDevice currentDevice].systemVersion;
UITextField *inputView;
if (version.doubleValue >= 13.0) {
NSUInteger numViews = [searchView.subviews count];
for(int i = 0; i < numViews; i++) {
if([[searchView.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) {
inputView = [searchView.subviews objectAtIndex:i];
}
}
} else {
inputView = [searchView valueForKey:@"_searchField"];
}
... ...
... ...
iOS13 黑夜模式
iOS13简单适配
关于新增iOS 13 Dark Mode API
1、全局配置
info.plist
key: User Interface Style
value:Light/Dark
2、单界面配置
-(UIUserInterfaceStyle)overrideUserInterfaceStyle{
return UIUserInterfaceStyleDark;
}
typedef NS_ENUM(NSInteger, UIUserInterfaceStyle) {
UIUserInterfaceStyleUnspecified,
UIUserInterfaceStyleLight,
UIUserInterfaceStyleDark,
} API_AVAILABLE(tvos(10.0)) API_AVAILABLE(ios(12.0)) API_UNAVAILABLE(watchos);
3、模拟器调黑夜模式:在Xcode中调Environment Overrides
调黑夜模式
4、图片黑夜模式适配
Any
Any/Dark
Any/Dark/Light
5、其他
其他Set
网友评论