Customizing the More menu on a Tab bar

后端 未结 6 745
野性不改
野性不改 2020-11-27 11:58

I am using a tab bar (UITabBarController) on my app and I wish to customize the appearance of the table that appears when you click the more button. I have worked out how to

6条回答
  •  醉话见心
    2020-11-27 12:27

    This works for me in iOS 13, Swift 5.1:

    extension MyTabBarController: UITabBarControllerDelegate {
        // handle a select of the More tab
        func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
            // style all the tab bar windows and the More tab bar tableview
            if viewController == moreNavigationController,
                let moreTableView = moreNavigationController.topViewController?.view as? UITableView {
                view.tintColor = .systemOrange
                moreNavigationController.navigationBar.tintColor = .systemOrange
                moreTableView.tintColor = .systemOrange
                moreTableView.backgroundColor = UIColor(named: "Your Color")
                moreTableView.visibleCells.forEach {
                    $0.backgroundColor = UIColor(named: "Your Color")
                }
            }
        }
    }
    

提交回复
热议问题