CircleBar
CircleBar copied to clipboard
Initial position for the first tab is not correct.
The initial position for the first tab
When navigation between the tabs. The position will display correctly.
The initial position for the first tab
When navigation between the tabs. The position will display correctly.
me, too
I have the same problem :(
I have the same.
Hi guys,
i know it's not the best solution but it's work.
On SHCircleBarController.swift add the following code:
override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let idx = 0 selectedIndex = idx let tabWidth = self.view.bounds.width / CGFloat(self.tabBar.items!.count) UIView.animate(withDuration: 0.3) { self.circleView.frame = CGRect(x: (tabWidth * CGFloat(idx) + tabWidth / 2 - 30), y: self.tabBar.frame.origin.y - 15, width: 60, height: 60) } UIView.animate(withDuration: 0.15, animations: { self.circleImageView.alpha = 0 }) { (_) in self.circleImageView.image = self.image(with: self.tabBar.items?[idx].image, scaledTo: CGSize(width: 30, height: 30)) UIView.animate(withDuration: 0.15, animations: { self.circleImageView.alpha = 1 }) } if let controller = viewControllers?[idx] { delegate?.tabBarController?(self, didSelect: controller) } }
Hola @nweaveahh @OleksiiShulzhenko @Madrox24 When the tab bar is initially loaded, the number of tab bar of tab bar's items is nil and the default value '4' is taken to keep running. So, the tab bar item is initially at wrong position. The best solution is to have a property for tabWidth inside controller and directly assign the value to it. Thanks! 😊😊😊