Closed MaeseppTarvo closed 7 years ago
Hey! I just wanted to know why does this loads every view all at once not only after tab click? It causes so much lag. I am pretty sure, this is library's fault. I am using it with Swift like this:
var tabBar: BATabBarController! override func viewDidLoad() { super.viewDidLoad() } let tabBarItem1: BATabBarItem = { let tabBarItem = BATabBarItem(image: UIImage(named: "Tab")?.withRenderingMode(.alwaysTemplate), selectedImage: UIImage(named: "Tab")) tabBarItem?.tintColor = MainColors.mainLighterGray return tabBarItem! }() let tabBarItem2: BATabBarItem = { let tabBarItem = BATabBarItem(image: UIImage(named: "Tab")?.withRenderingMode(.alwaysTemplate), selectedImage: UIImage(named: "Tab")) tabBarItem?.tintColor = MainColors.mainLighterGray return tabBarItem! }() let tabBarItem3: BATabBarItem = { let tabBarItem = BATabBarItem(image: UIImage(named: "Tab")?.withRenderingMode(.alwaysTemplate), selectedImage: UIImage(named: "Tab")) tabBarItem?.tintColor = MainColors.mainLighterGray return tabBarItem! }() override func viewDidLayoutSubviews() { var vc1: UIViewController! var vc2: UIViewController! var vc3: UIViewController! let storyboard = UIStoryboard(name: "Main", bundle: nil) vc1 = storyboard.instantiateViewController(withIdentifier: "Tab1") vc2 = storyboard.instantiateViewController(withIdentifier: "Tab2") vc3 = storyboard.instantiateViewController(withIdentifier: "Tab3") self.tabBar = BATabBarController() self.tabBar.tabBarItemStrokeColor = UIColor("#3F72AF") self.tabBar.viewControllers = [vc1, vc2, vc3] self.tabBar.tabBarItems = [tabBarItem1, tabBarItem2, tabBarItem3] self.tabBar.setSelectedView(vc1, animated: false) self.tabBar.tabBarBackgroundColor = MainColors.mainDarkerGray self.tabBar.delegate = self self.view.addSubview(self.tabBar.view) } func tabBarController(_ tabBarController: BATabBarController!, didSelect viewController: UIViewController!) { print(viewController) }
Hey! I just wanted to know why does this loads every view all at once not only after tab click? It causes so much lag. I am pretty sure, this is library's fault. I am using it with Swift like this: