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

How can i use when i don't use storyBoard,i just use only code #148

Closed lucy12356 closed 6 years ago

lucy12356 commented 7 years ago

i don't know how to set tabBarItem to RAMAnimatedTabBarItem by code.can you provide a project by only code. sorry i'm a novice

XiaoChenYung commented 7 years ago

let tabBarIconHome: RAMAnimatedTabBarItem = RAMAnimatedTabBarItem(title: "Title1", image: #imageLiteral(resourceName: "image").withRenderingMode(.alwaysOriginal), selectedImage: #imageLiteral(resourceName: "image")) tabBarIconHome.animation = RAMBounceAnimation()

let tabBarIconProfile: RAMAnimatedTabBarItem = RAMAnimatedTabBarItem(title: "title", image: #imageLiteral(resourceName: "image").withRenderingMode(.alwaysOriginal), selectedImage: #imageLiteral(resourceName: "image").withRenderingMode(.alwaysOriginal)) tabBarIconProfile.animation = RAMBounceAnimation()

let homeNavController = UINavigationController(rootViewController: HomeVC()) homeNavController.tabBarItem = tabBarIconHome

let profileNavController = UINavigationController(rootViewController: ProfileVC()) profileNavController.tabBarItem = tabBarIconProfile

let tabController = RAMAnimatedTabBarController(viewControllers: [homeNavController, profileNavController])

window?.rootViewController = tabController window?.makeKeyVisible()