CircleBar icon indicating copy to clipboard operation
CircleBar copied to clipboard

Initial position for the first tab is not correct.

Open nweaveahh opened this issue 5 years ago • 6 comments

The initial position for the first tab Screen Shot 2019-09-18 at 11 36 58 AM

When navigation between the tabs. The position will display correctly.

Screen Shot 2019-09-18 at 11 37 07 AM

nweaveahh avatar Sep 18 '19 09:09 nweaveahh

The initial position for the first tab Screen Shot 2019-09-18 at 11 36 58 AM

When navigation between the tabs. The position will display correctly.

Screen Shot 2019-09-18 at 11 37 07 AM

me, too

zdiovo avatar Oct 04 '19 09:10 zdiovo

@perteadrian, can you please take a look at this?

Sent with GitHawk

perteraul avatar Oct 23 '19 10:10 perteraul

I have the same problem :(

Madrox24 avatar Oct 28 '19 20:10 Madrox24

I have the same.

OleksiiShulzhenko avatar Oct 29 '19 11:10 OleksiiShulzhenko

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) } }

simonepercossi avatar Dec 13 '19 16:12 simonepercossi

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! 😊😊😊

phoelapyae7 avatar Feb 22 '20 19:02 phoelapyae7