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.12k stars 1.33k forks source link

Icon Color bug #222

Closed Michele404 closed 5 years ago

Michele404 commented 6 years ago
    let storyBoard = UIStoryboard(name: "Main", bundle: nil)
    let vc = storyBoard.instantiateViewController(withIdentifier: "TabBarController") as! UITabBarController
        vc.selectedIndex = 2
    self.present(vc, animated: true, completion: nil)

When I run this part of code it show me the controller n.2 in the RamAnimatedTabBar but it will show the icon n.0 in the RamAnimatedTabBar with another color instead of the n.2 Help?

yusufkamilak commented 6 years ago

Hello @Michele404, simply change following index 0 to the starting index you wish in RAMAnimatedTabBarController.swift because it's being called once before anything selected yet as far as I observed.

if 0 == index { // selected first elemet
    item.selectedState()
    container.backgroundColor = (items as [RAMAnimatedTabBarItem])[index].bgSelectedColor
}
Michele404 commented 6 years ago

Ok, and how I should edit it?

yusufkamilak commented 6 years ago

You should change 0 to the index value of your starting tab @Michele404

Michele404 commented 6 years ago

1) If you do it all tab will got a color 2) You can’t pass data into cocoapods , you have to download it manually