在 Swift 5 中为 IOS 13 更改 tabBar 高度

Fab*_*uto 4 uitabbarcontroller ios swift swift5 ios13

我需要将UITabBar高度更改为 95。我可以在旧版本的 iOS Swift 中做到这一点。这是我在旧版本中工作的代码。

override func viewWillLayoutSubviews() {
    super.viewWillLayoutSubviews()

    tabBar.frame.size.height = 95
    tabBar.frame.origin.y = view.frame.height - 95

    menuButton.frame.origin.y = self.view.bounds.height - tabBar.frame.size.height - 10
    shadowBtn.frame.origin.y = self.view.bounds.height - tabBar.frame.size.height - 15
}
Run Code Online (Sandbox Code Playgroud)

Sar*_*yan 18

Try it in viewDidLayoutSubviews

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    tabBar.frame.size.height = 95
    tabBar.frame.origin.y = view.frame.height - 95
}
Run Code Online (Sandbox Code Playgroud)