Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APP is crashing #3

Open
KOSURUUDAYSAIKUMAR opened this issue Feb 7, 2024 · 0 comments
Open

APP is crashing #3

KOSURUUDAYSAIKUMAR opened this issue Feb 7, 2024 · 0 comments

Comments

@KOSURUUDAYSAIKUMAR
Copy link

KOSURUUDAYSAIKUMAR commented Feb 7, 2024

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant