适配 iOS13

2019-10-31  本文已影响0人  jsone

1、深夜模式
如果app不支持深夜模式,可以在info.plist添加UIUserInterfaceStyle,设置值为Light

<key>UIUserInterfaceStyle</key>
 <string>Light</string>
WX20191118-202430@2x.png

深夜模式:


适配 iOS13
适配 iOS13

正常模式:


适配 iOS13
适配 iOS13

2、模态视图转场动画风格默认为新增的卡片式动画,modalPresentationStyle的默认值为
UIModalPresentationAutomatic
如果要使用原来的全屏模态动画需要设置modalPresentationStyle的值为UIModalPresentationFullScreen

UIViewController *vc = [[UIViewController alloc] init];
vc.modalPresentationStyle = UIModalPresentationFullScreen;
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];
nc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:nc animated:YES completion:nil];

3、设置UITabBarItem样式

if(@available(iOS 13.0, *))
    {
        [[UITabBar appearance] setTintColor:[UIColor orangeColor]];
        [[UITabBar appearance] setUnselectedItemTintColor:[UIColor grayColor]];
    }
    else
    {
        [[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor grayColor],} forState:UIControlStateNormal];
        [[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor orangeColor]} forState:UIControlStateSelected];
    }

4、启动图片展示弃用LaunchImage,只能用LaunchScreen

5、UISearchBar开放输入框属性searchTextField,可以直接获取到输入框的样式

UITextField *textfield = [searchBar valueForKey:@"searchField"];
if(@available(iOS 13.0, *))
{
    textfield = searchBar.searchTextField;
}
else
{
    UIImageView *backgroundView = textfield.subviews.firstObject;
        
}

6、正式弃用UIWebView,只能WKWebView的使用

7、弃用valueForKey

上一篇 下一篇

猜你喜欢

热点阅读