适配 iOS13

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

UIUserInterfaceStyle
 Light

深夜模式:


图片发自App

图片发自App

正常模式:


图片发自App

图片发自App

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

你可能感兴趣的:(适配 iOS13)