Issue #224
let tabBarController = UITabBarController()
let navigationController1 = UINavigationController(rootViewController: viewController1)
let navigationController2 = UINavigationController(rootViewController: viewController2)
let navigationController3 = UINavigationController(rootViewController: viewController3)
navigationController2.isNavigationBarHidden = true
navigationController1.tabBarItem.image = R.image.profile()
navigationController2.tabBarItem.image = R.image.books()
navigationController3.tabBarItem.image = R.image.settings()
tabBarController.tabBar.tintColor = .yellow
tabBarController.viewControllers = [navigationController1, navigationController2, navigationController3]
Use tintColor
instead of the deprecated selectedImageTintColor
to indicate selected item color.
For icon size, check Tab Bar Icon Size, usually 50x50 for 2x and 75x75 for 3x
In portrait orientation, tab bar icons appear above tab titles. In landscape orientation, the icons and titles appear side-by-side. Depending on the device and orientation, the system displays either a regular or compact tab bar. Your app should include custom tab bar icons for both sizes.