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

Seting animation programmatically does not work #287

Closed huylv-teko closed 4 years ago

huylv-teko commented 4 years ago

Hey, i setup tab like this but the animation does now show. Please help :D Im using iphone11 pro simulator with ios 13.5

class HomeTabBarController: RAMAnimatedTabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let homeTab = HomeViewController.instantiateFromNib()
        homeTab.tabBarItem = RAMAnimatedTabBarItem(tabBarSystemItem: .favorites, tag: 0)
        let storeTab = StoreTabViewController.instantiateFromNib()
        storeTab.tabBarItem = RAMAnimatedTabBarItem(tabBarSystemItem: .contacts, tag: 1)
        let menuTab = MenuTabViewController.instantiateFromNib()
        menuTab.tabBarItem = RAMAnimatedTabBarItem(tabBarSystemItem: .featured, tag: 2)
        let menu2Tab = MenuTabViewController.instantiateFromNib()
        menu2Tab.tabBarItem = RAMAnimatedTabBarItem(tabBarSystemItem: .more, tag: 3)
        viewControllers = [homeTab, storeTab, menuTab, menu2Tab]
        animatedItems[0].animation = RAMLeftRotationAnimation()
        animatedItems[1].animation = RAMLeftRotationAnimation()
        animatedItems[2].animation = RAMLeftRotationAnimation()
        animatedItems[3].animation = RAMLeftRotationAnimation()
    }
}
igork-ramotion commented 4 years ago

@huylv-teko Hey, to work properly RAMAnimatedTabBarItem need UIImage be set. System item will not work. Please use one of this init methods:

public convenience init(title: String?, image: UIImage?, tag: Int)
public convenience init(title: String?, image: UIImage?, selectedImage: UIImage?)
huylv-teko commented 4 years ago

Yeah thank you, you should add this note to README :D