mapierce / WaveTab

🌊🌊 A Wave-like UITabBarController 🌊🌊
https://lookwhatmattmade.com/writing/custom-tab-bar-part-1/
MIT License
39 stars 5 forks source link

Tab bar circle not updating properly after showing or hiding side menu drawer. #6

Open Satish24sp opened 2 years ago

Satish24sp commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Add side menu drawer along with wave tab bar
  2. Click or slide to show or hide side menu.
  3. Tab bar not updating properly, when side menu hides.

Expected behavior Wave tab bar is working perfectly when I use only bottom tab bar but when I implemented the side menu or when I come back from another view controller, it's wave behaviour is not updating. It should work same on every condition not only for bottom tab bar.

Screenshots/Video Here is the video link for the same.

Video Link

https://user-images.githubusercontent.com/35003745/151233944-896ad4de-81db-4f05-a8de-bc5d9b161474.mov

Screenshot Link

Screenshot 2022-01-27 at 1 01 47 AM

Smartphone:

Dhvani19 commented 2 years ago

While circle and imageView is added to view just remove both from superview. it works for me!

func setupCircle(_ width: Float) { circle?.removeFromSuperview() // ->> Add this line circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: CGFloat(width), height: CGFloat(width))) circle?.layer.cornerRadius = CGFloat(width) / 2 circle?.center = CGPoint(x: tabBarItems[safeSelectedIndex].center.x, y: 0.0) tabBar.addSubview(circle!) }

func setupImageView(_ center: Float) { let image = viewControllers?[safeSelectedIndex].tabBarItem.selectedImage imageView?.removeFromSuperview() // ->> Add this line imageView = UIImageView(image: image) imageView?.contentMode = UIView.ContentMode.scaleToFill circle?.addSubview(imageView!) imageView?.center = CGPoint(x: CGFloat(center), y: CGFloat(center)) }

Thanks.

MrPrakashR commented 1 year ago

Fixed in This PR #8

Satish24sp commented 1 year ago

@MrPrakashR thanks will check.