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

Add animations programmatically #246

Closed furiosFast closed 5 years ago

furiosFast commented 5 years ago

hi, is possible to add animation to tabbaritem programmatically and not from storyboard?

0ber commented 5 years ago

let item = RAMAnimatedTabBarItem() item.animation = __ANIMATION___ look https://github.com/Ramotion/animated-tab-bar/blob/master/RAMAnimatedTabBarController/RAMAnimatedTabBarController.swift#L66

furiosFast commented 5 years ago

Hello and thanks for the reply. After I followed the whole procedure you described to implement the library, in the appDelegate I added the following code, but I still don't get any animation

guard let myTabBar = self.window?.rootViewController as? RAMAnimatedTabBarController else { return }
myTabBar.animatedItems[0].title = loc("tab_SCALE
myTabBar.animatedItems[0].image = UIImage(named: "icons8-moleskine-filled")
myTabBar.animatedItems[0].animation = RAMBounceAnimation()

myTabBar.animatedItems[1].title = loc("tab_ROSA")
myTabBar.animatedItems[1].image = UIImage(named: "icons8-wind-rose-filled")
myTabBar.animatedItems[1].animation = RAMRightRotationAnimation()

myTabBar.animatedItems[2].title = loc("tab_PREVISIONI")
myTabBar.animatedItems[2].image = UIImage(named: "icons8-windsock-filled")
myTabBar.animatedItems[2].animation = RAMBounceAnimation()

If I remove this code and only set the preferences from the storyboard, I don't even see the icons

0ber commented 5 years ago

I check, it works look for https://github.com/0ber/AnimatedTabBar-Pod-Test/commit/60219c91f80e629c4143610d20daf2f4862fd2e7 branch https://github.com/0ber/AnimatedTabBar-Pod-Test/tree/feature/animations_programmatically_246

huylv-teko commented 4 years ago

I check, it works look for 0ber/AnimatedTabBar-Pod-Test@60219c9 branch https://github.com/0ber/AnimatedTabBar-Pod-Test/tree/feature/animations_programmatically_246

so we can not set animation programmatically without edit source, can we?