Ramotion / animated-tab-bar

:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion
https://www.ramotion.com/animated-tab-bar-ios-app-development-ui-library/
MIT License
11.13k stars 1.33k forks source link

Change tabbar programatically #128

Closed joaoh82 closed 6 years ago

joaoh82 commented 8 years ago

I need to change the selected TabBar programatically and usually I would do it just like this.

self.tabBarController?.selectedIndex = 2

And it is working, but how do I do that and animate and change the selected tabbar icon to the correct one?

Thanks

seven-ply commented 8 years ago

+1

kuyazee commented 8 years ago

@seven-ply @joaoh82 you do this

 let animatedTabBar = self.tabBarController as! RAMAnimatedTabBarController
 animatedTabBar.setSelectIndex(from: self.tabBarController!.selectedIndex, to: 2)
seven-ply commented 8 years ago

@kuyazee you're awesome man. This works. Thank you very much.