如何将自定义 tabBar 设置为我的自定义 TabBarController?
How to set a custom tabBar to my custom TabBarController?
我的自定义标签栏:
class MyTabBar: UITabBar {
}
My custom tab Bar Controller:
class MyTabBarController: UITabBarController {
}
我的问题是如何在我的自定义标签栏控制器中使用我的自定义标签栏?
我通过将 '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()
}
}
我的自定义标签栏:
class MyTabBar: UITabBar {
}
My custom tab Bar Controller:
class MyTabBarController: UITabBarController {
}
我的问题是如何在我的自定义标签栏控制器中使用我的自定义标签栏?
我通过将 '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()
}
}