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
Under MIT License
By Ramotion

animation ios swift library ui material-design




ANIMATED TAB BAR

Swift UI module library for adding animation to iOS tabbar items and icons.

We specialize in the designing and coding of custom UI for Mobile Apps and Websites.


Stay tuned for the latest updates:



Requirements

Installation

Just add the RAMAnimatedTabBarController folder to your project.


or use CocoaPods with Podfile:
ruby
pod 'RAMAnimatedTabBarController'


or Carthage users can simply add to their Cartfile:
github "Ramotion/animated-tab-bar"


or Swift Package Manager


Usage


  1. Create a new UITabBarController in your storyboard or nib.




  2. Set the class of the UITabBarController to RAMAnimatedTabBarController in your Storyboard or nib.




  3. For each UITabBarItem, set the class to RAMAnimatedTabBarItem.




  4. Add a custom image icon for each RAMAnimatedTabBarItem




  5. Add animation for each RAMAnimatedTabBarItem :



  6. drag and drop an NSObject item into your ViewController

  7. set its class to ANIMATION_CLASS (where ANIMATION_CLASS is the class name of the animation you want to use)

  8. connect the outlet animation in RAMAnimatedTabBarItem to your ANIMATION_CLASS
    Demonstration video for step 5


Included Animations

Creating Custom Animations

  1. Create a new class which inherits from RAMItemAnimation:


swift
class NewAnimation : RAMItemAnimation

2. Implement the methods in RAMItemAnimationProtocol:


swift
// method call when Tab Bar Item is selected
override func playAnimation(icon: UIImageView, textLabel: UILabel) {
// add animation
}

swift
// method call when Tab Bar Item is deselected
override func deselectAnimation(icon: UIImageView, textLabel: UILabel, defaultTextColor: UIColor, defaultIconColor: UIColor) {
// add animation
}

swift
// method call when TabBarController did load
override func selectedState(icon: UIImageView, textLabel: UILabel) {
// set selected state
}



  1. Example:


``` swift
import RAMAnimatedTabBarController


class RAMBounceAnimation : RAMItemAnimation {


override func playAnimation(_ icon: UIImageView, textLabel: UILabel) {
playBounceAnimation(icon)
textLabel.textColor = textSelectedColor
}

override func deselectAnimation(_ icon: UIImageView, textLabel: UILabel, defaultTextColor: UIColor, defaultIconColor: UIColor) {
textLabel.textColor = defaultTextColor
}

override func selectedState(_ icon: UIImageView, textLabel: UILabel) {
textLabel.textColor = textSelectedColor
}

func playBounceAnimation(_ icon : UIImageView) {

let bounceAnimation = CAKeyframeAnimation(keyPath: "transform.scale")
bounceAnimation.values = [1.0 ,1.4, 0.9, 1.15, 0.95, 1.02, 1.0]
bounceAnimation.duration = TimeInterval(duration)
bounceAnimation.calculationMode = kCAAnimationCubic

icon.layer.add(bounceAnimation, forKey: "bounceAnimation")
}


}
```


📄 License

Animated Tab Bar is released under the MIT license.
See LICENSE for details.


This library is a part of a selection of our best UI open-source projects.


If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com


📱 Get the Showroom App for iOS to give it a try

Try this UI component and more like this in our iOS app. Contact us if interested.