【Swift 适配iOS15】踩坑记录 - 想做次第一个吃螃蟹的人

  昨天iOS15发布了,但是对于开发者来说又多了一些适配问题。

  1、UITableView位置下移了?

if #available(iOS 15.0, *) {
            self.mainTableView.sectionHeaderTopPadding = 0
        }

   2、UITabBar显示是不是异常了?

        if #available(iOS 15.0, *) {
            let appearance = UITabBarAppearance()
            appearance.configureWithOpaqueBackground()
            if darkMode {
                appearance.backgroundColor = UIColor.darkBackgroundColour
            } else {
                appearance.backgroundColor = .white
            }
            appearance.shadowImage = nil
            appearance.shadowColor = nil
            appDelegate.tabBarController.tabBar.standardAppearance = appearance
            appDelegate.tabBarController.tabBar.scrollEdgeAppearance = appDelegate.tabBarController.tabBar.standardAppearance
        }
        

 

posted @ 2021-09-22 22:28  Mr·Xu  阅读(635)  评论(1编辑  收藏  举报