iOS 13更新

StatusBur

iOS 13之前获取StatusBar代码:

 UIApplication *app = [UIApplication sharedApplication];
 id _statusBar = [app valueForKeyPath:@"_statusBar"];

iOS 13之后已经获取不到了,iOS 13之后获取StatusBar

 UIStatusBarManager *statusBarManager = [UIApplication sharedApplication].keyWindow.windowScene.statusBarManager;
    id _statusBar = nil;
    if ([statusBarManager respondsToSelector:@selector(createLocalStatusBar)]) {
        UIView *_localStatusBar = [statusBarManager performSelector:@selector(createLocalStatusBar)];
        if ([_localStatusBar respondsToSelector:@selector(statusBar)]) {
            _statusBar = [_localStatusBar performSelector:@selector(statusBar)];
        }
    }
presentViewController出现分页式

iOS 13之前modalPresentationStyle默认为UIModalPresentationFullScreen,iOS 13 之后默认为UIModalPresentationAutomatic,present之前设置一下modalPresentationStyle的值

tabBar选中颜色变蓝色
    if (@available(iOS 13.0, *)) {
        tabbar.tabBar.tintColor = ThemeTools.themeMainColor;
        tabbar.tabBar.unselectedItemTintColor = ThemeTools.tabDeselectColor;
        UITabBarItem *item = [UITabBarItem appearance];
        item.titlePositionAdjustment = UIOffsetMake(0, -2);
        [item setTitleTextAttributes:@{NSFontAttributeName:ThemeTools.font12light} forState:UIControlStateNormal];
        [item setTitleTextAttributes:@{NSFontAttributeName:ThemeTools.font12light} forState:UIControlStateSelected];
    } else {
        UITabBarItem *item = [UITabBarItem appearance];
        item.titlePositionAdjustment = UIOffsetMake(0, -2);
        [item setTitleTextAttributes:@{NSFontAttributeName:ThemeTools.font12light, NSForegroundColorAttributeName:ThemeTools.tabDeselectColor} forState:UIControlStateNormal];
        [item setTitleTextAttributes:@{NSFontAttributeName:ThemeTools.font12light, NSForegroundColorAttributeName:ThemeTools.themeMainColor} forState:UIControlStateSelected];
    }
不适配黑暗模式

在Info.plist文件中添加Key:User Interface Style,值类型设置为String,值为Light

你可能感兴趣的:(iOS 13更新)