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

support Programmatic without storyboard or nib. #86

Closed arden closed 8 years ago

arden commented 8 years ago

the animated-tab-bar support Programmatic without storyboard or nib?

respan commented 8 years ago

Yes. Something like this:

class TabBarController: RAMAnimatedTabBarController {
    override func viewDidLoad() {
        let tabAnimation = RAMBounceAnimation()
        tabAnimation.textSelectedColor = .redColor()
        tabAnimation.iconSelectedColor = .redColor()

        let tabBarItem = RAMAnimatedTabBarItem(title: "Example", image: UIImage(named: "Example"), selectedImage: nil)
        tabBarItem.textColor = .blackColor()
        tabBarItem.iconColor = .blackColor()
        tabBarItem.animation = tabAnimation

        let navigationController = UINavigationController(rootViewController: UIViewController())
        navigationController?.tabBarItem = tabBarItem  

        viewControllers = [navigationController!]

        super.viewDidLoad()
    }
erinbleiweiss commented 8 years ago

+1 for the above suggestion. This would be very useful

respan commented 8 years ago

But it's already supported :) You can try this code

arden commented 8 years ago

this can write to readme.