You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class DashboardTabBarViewController: UITabBarController { @IBOutlet weak var avTabBar: AVTabBar!
override func viewDidLoad() {
super.viewDidLoad()
avTabBar.unSelectedColor = UIColor(fromHex: "#ABCEF5")
avTabBar.selectedColor = UIColor(fromHex: "#006EE9")
let item1 = UITabBarItem(title: "Home", image: UIImage(named: "home"), tag: 0)
let item2 = UITabBarItem(title: "Statistical", image: UIImage(named: "monitoring"), tag: 1)
let item3 = UITabBarItem(title: "Statistical", image: UIImage(named: "water_drop"), tag: 2)
let item4 = UITabBarItem(title: "Statistical", image: UIImage(named: "cloud_off"), tag: 3)
let items = [item1, item2, item3, item4]
let viewController1 = HomePageViewController()
let viewController2 = StatisticalViewController()
let vc3 = WaterDeptViewController()
let vc4 = WRDOfflineViewController()
self.viewControllers = [viewController1, viewController2, vc3, vc4]
self.avTabBar.setItems(items, animated: true)
}
}
App is crashing at this line of code: avTabBar.setItems(items, animated: true)
Crash : *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Directly modifying a tab bar managed by a tab bar controller is not allowed.'
Can you please help. I have an requirement.
The text was updated successfully, but these errors were encountered:
class DashboardTabBarViewController: UITabBarController {
@IBOutlet weak var avTabBar: AVTabBar!
override func viewDidLoad() {
super.viewDidLoad()
avTabBar.unSelectedColor = UIColor(fromHex: "#ABCEF5")
avTabBar.selectedColor = UIColor(fromHex: "#006EE9")
let item1 = UITabBarItem(title: "Home", image: UIImage(named: "home"), tag: 0)
let item2 = UITabBarItem(title: "Statistical", image: UIImage(named: "monitoring"), tag: 1)
let item3 = UITabBarItem(title: "Statistical", image: UIImage(named: "water_drop"), tag: 2)
let item4 = UITabBarItem(title: "Statistical", image: UIImage(named: "cloud_off"), tag: 3)
let items = [item1, item2, item3, item4]
let viewController1 = HomePageViewController()
let viewController2 = StatisticalViewController()
let vc3 = WaterDeptViewController()
let vc4 = WRDOfflineViewController()
self.viewControllers = [viewController1, viewController2, vc3, vc4]
self.avTabBar.setItems(items, animated: true)
}
}
The text was updated successfully, but these errors were encountered: