You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
6.2 KiB

  1. [![header](./header.png)](https://ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=animated-tab-bar-logo)
  2. <img src="https://github.com/Ramotion/animated-tab-bar/blob/master/Screenshots/animatedTabBar.gif" width="600" height="450" />
  3. <br><br/>
  4. # Animated-tab-bar
  5. [![CocoaPods](https://img.shields.io/cocoapods/p/RAMAnimatedTabBarController.svg)](http://cocoapods.org/pods/RAMAnimatedTabBarController)
  6. [![CocoaPods](https://img.shields.io/cocoapods/v/RAMAnimatedTabBarController.svg)](http://cocoapods.org/pods/RAMAnimatedTabBarController)
  7. [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Ramotion/animated-tab-bar)
  8. [![Swift 4.0](https://img.shields.io/badge/Swift-4.0-green.svg?style=flat)](https://developer.apple.com/swift/)
  9. [![Twitter](https://img.shields.io/badge/Twitter-@Ramotion-blue.svg?style=flat)](http://twitter.com/Ramotion)
  10. [![Travis](https://img.shields.io/travis/Ramotion/animated-tab-bar.svg)](https://travis-ci.org/Ramotion/animated-tab-bar)
  11. [![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/Ramotion)
  12. ## About
  13. This project is maintained by Ramotion, Inc.<br>
  14. We specialize in the designing and coding of custom UI for Mobile Apps and Websites.<br>
  15. **Looking for developers for your project?**<br>
  16. This project is maintained by Ramotion, Inc. We specialize in the designing and coding of custom UI for Mobile Apps and Websites.
  17. <a href="mailto:alex.a@ramotion.com?subject=Project%20inquiry%20from%20Github">
  18. <img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
  19. <br>
  20. The [iPhone mockup](https://store.ramotion.com/product/iphone-x-clay-mockups?utm_source=gthb&utm_medium=special&utm_campaign=animated-tab-bar) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=animated-tab-bar).
  21. ## Try this UI control in action
  22. <a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=gthb-animated-tab-bar&mt=8" > <img src="https://github.com/Ramotion/navigation-stack/raw/master/Download_on_the_App_Store_Badge_US-UK_135x40.png" width="170" height="58"></a>
  23. Screencast from our Demo
  24. ![Animation](https://raw.githubusercontent.com/Ramotion/animated-tab-bar/master/Screenshots/RAMAnimatedTabBarDemo.gif)
  25. ## Requirements
  26. - iOS 9.0+
  27. - xCode 9
  28. ## Installation
  29. Just add the RAMAnimatedTabBarController folder to your project.
  30. or use [CocoaPods](https://cocoapods.org) with Podfile:
  31. ``` ruby
  32. pod 'RAMAnimatedTabBarController'
  33. ```
  34. or [Carthage](https://github.com/Carthage/Carthage) users can simply add to their `Cartfile`:
  35. ```
  36. github "Ramotion/animated-tab-bar"
  37. ```
  38. ## Usage
  39. 1. Create a new UITabBarController in your storyboard or nib.
  40. 2. Set the class of the UITabBarController to RAMAnimatedTabBarController in your Storyboard or nib.
  41. 3. For each UITabBarItem, set the class to RAMAnimatedTabBarItem.
  42. 4. Add a custom image icon for each RAMAnimatedTabBarItem
  43. 5. Add animation for each RAMAnimatedTabBarItem :
  44. * drag and drop an NSObject item into your ViewController
  45. * set its class to ANIMATION_CLASS (where ANIMATION_CLASS is the class name of the animation you want to use)
  46. * connect the outlet animation in RAMAnimatedTabBarItem to your ANIMATION_CLASS
  47. [Demonstration video for step 5](http://vimeo.com/112390386)
  48. ## Included Animations
  49. * RAMBounceAnimation
  50. * RAMLeftRotationAnimation
  51. * RAMRightRotationAnimation
  52. * RAMFlipLeftTransitionItemAnimations
  53. * RAMFlipRightTransitionItemAnimations
  54. * RAMFlipTopTransitionItemAnimations
  55. * RAMFlipBottomTransitionItemAnimations
  56. * RAMFrameItemAnimation
  57. * RAMFumeAnimation
  58. ## Creating Custom Animations
  59. 1. Create a new class which inherits from RAMItemAnimation:
  60. ``` swift
  61. class NewAnimation : RAMItemAnimation
  62. ```
  63. 2. Implement the methods in RAMItemAnimationProtocol:
  64. ``` swift
  65. // method call when Tab Bar Item is selected
  66. override func playAnimation(icon: UIImageView, textLabel: UILabel) {
  67. // add animation
  68. }
  69. ```
  70. ``` swift
  71. // method call when Tab Bar Item is deselected
  72. override func deselectAnimation(icon: UIImageView, textLabel: UILabel, defaultTextColor: UIColor, defaultIconColor: UIColor) {
  73. // add animation
  74. }
  75. ```
  76. ``` swift
  77. // method call when TabBarController did load
  78. override func selectedState(icon: UIImageView, textLabel: UILabel) {
  79. // set selected state
  80. }
  81. ```
  82. 3. Example:
  83. ``` swift
  84. import RAMAnimatedTabBarController
  85. class RAMBounceAnimation : RAMItemAnimation {
  86. override func playAnimation(_ icon: UIImageView, textLabel: UILabel) {
  87. playBounceAnimation(icon)
  88. textLabel.textColor = textSelectedColor
  89. }
  90. override func deselectAnimation(_ icon: UIImageView, textLabel: UILabel, defaultTextColor: UIColor, defaultIconColor: UIColor) {
  91. textLabel.textColor = defaultTextColor
  92. }
  93. override func selectedState(_ icon: UIImageView, textLabel: UILabel) {
  94. textLabel.textColor = textSelectedColor
  95. }
  96. func playBounceAnimation(_ icon : UIImageView) {
  97. let bounceAnimation = CAKeyframeAnimation(keyPath: "transform.scale")
  98. bounceAnimation.values = [1.0 ,1.4, 0.9, 1.15, 0.95, 1.02, 1.0]
  99. bounceAnimation.duration = TimeInterval(duration)
  100. bounceAnimation.calculationMode = kCAAnimationCubic
  101. icon.layer.add(bounceAnimation, forKey: "bounceAnimation")
  102. }
  103. }
  104. ```
  105. <br>This library is a part of a <a href="https://github.com/Ramotion/swift-ui-animation-components-and-libraries"><b>selection of our best UI open-source projects.</b></a></br>
  106. # Get the Showroom App for iOS to give it a try
  107. Try this UI library in our iOS app. Contact us if you interested in hiring the team.
  108. <a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=animated-tab-bar&mt=8" >
  109. <img src="https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png" width="117" height="34"></a>
  110. <a href="mailto:alex.a@ramotion.com?subject=Project%20inquiry%20from%20Github">
  111. <img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
  112. <br>
  113. <br>
  114. Follow us for the latest updates<br>
  115. <a href="https://goo.gl/rPFpid" >
  116. <img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a>