【问题标题】:How to set a custom tabBar to my custom TabBarController?如何为我的自定义 TabBarController 设置自定义 tabBar?
【发布时间】:2019-12-28 04:21:25
【问题描述】:

我的自定义标签栏:

class MyTabBar: UITabBar {

}

My custom tab Bar Controller: 

class MyTabBarController: UITabBarController {

}

我的问题是如何在自定义标签栏控制器中使用自定义标签栏?

【问题讨论】:

标签: ios swift iphone xcode autolayout


【解决方案1】:

我通过将“tabBar”的值设置为我的自定义 tabBar 来做到这一点。

setValue(MycustomTabBar(frame: tabBar.frame), forKey: "tabBar")

class MyCustomTabBarController: UITabBarController {
override func viewDidLoad() {
        super.viewDidLoad()
        setValue(TBar(frame: tabBar.frame), forKey: "tabBar")
        view.backgroundColor = .white
        createShape()
    }
}

【讨论】:

    猜你喜欢
    • 2013-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-28
    • 2020-07-28
    • 1970-01-01
    相关资源
    最近更新 更多