1、模拟器调试暗黑模式
打开模拟器-设置-开发者:
打开选项,即可开启暗黑模式
2、app禁止暗黑模式
在info.plist中,增加一行key为User Interface Style;value为Light,这样你的app就不会跟随手机设置的模式而改变了
3、ios13下模态跳转presentViewController
在ios13下,苹果将 presentViewController默认的style改成了 UIModalPresentationAutomatic之前的是 UIModalPresentationFullScreen ,所以需要加一行代码,手动去选择
vc.modalPresentationStyle = UIModalPresentationFullScreen;
4、ios13下获取状态栏的高度
之前在APPDelegate下无法获取到,需要在界面加载完成的viewDidLoad后,才会获取到,这样处理,可以解决
- (void)viewDidLoad {
//写在super之前,可以更好的保证,在当前界面加载之前,将状态栏高度获取到
//主要当时是将状态栏的高度注入JS,给H5调用,在super之后,web已经加载好了,高度获取的时机晚了
[[UIApplication sharedApplication] statusBarFrame].size.height;
[super viewDidLoad];
// Do any additional setup after loading the view.
}
5、获取searchBar中的TextField方法更改,会引起崩溃
//之前代码
UITextField * searchField = [searchBar valueForKey:@"_searchField"];
UILabel *searchPlaceLabel = [searchField valueForKey:@"placeholderLabel"];
searchPlaceLabel.textColor = [UIColor colorWithHex:@"#999999"];
[searchField setValue:[UIFont boldSystemFontOfSize:14] forKeyPath:@"_placeholderLabel.font"];
ios13之后把SearchBar中的textField直接暴露给开发者使用,无需在通过kvc获取。
//修改后
UITextField * searchField = nil;
if (@available(iOS 13.0, *)) {
searchField =searchBar.searchTextField;
}else {
searchField = [searchBar valueForKey:@"_searchField"];
}
NSMutableAttributedString *arrStr = [[NSMutableAttributedString alloc] initWithString:searchField.placeholder attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:[UIColor colorWithHex:@"#999999"]}];
searchField.attributedPlaceholder = arrStr;
6、获取statusBar,方法更新如下,会引起崩溃
if (@available(iOS 13.0, *)) {
UIStatusBarManager *statusBarManager = [UIApplication sharedApplication].keyWindow.windowScene.statusBarManager;
if ([statusBarManager respondsToSelector:@selector(createLocalStatusBar)]) {
UIView *_localStatusBar = [statusBarManager performSelector:@selector(createLocalStatusBar)];
if ([_localStatusBar respondsToSelector:@selector(statusBar)]) {
_statusBar = [_localStatusBar performSelector:@selector(statusBar)];
}
}
} else {
// Fallback on earlier versions
_statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
}
这次13的更新整体需要修改的问题相对之前的,工作量大了不少,第一天更新的时候,微信完全打不开了,
后来通过【设置-通用-还原-还原所有设置】解决闪退问题,适配持续进行中。。。