/AnimatedRoundButton

Beautiful animated round button. Written in Swift.

Primary LanguageSwiftMIT LicenseMIT

AnimatedRoundButton

Beautiful animated round button.

Demo
Demo

Contents

Requirements

  • iOS 8.0+
  • Swift 3.0+

Installation

All logic is in AnimatedRoundButton.swift file. Just copy this file to your project.

Usage

1 - You can set class AnimatedRoundButton to view in storyboard an use @IBInspectable properties to setup button.

2 - You can do it from code:

let button = AnimatedRoundButton(
  frame: CGRect(x: 0, y: 0, width: 200, height: 200)
)
button.center = view.center
view.addSubview(button)
        
button.text = "AnimatedRoundButton"
button.font = UIFont(name: "Helvetica", size: 25)!

3 - You may setup colors for different states

button.textColorsForStates[.normal] = UIColor.red
button.textColorsForStates[.up] = UIColor.white
button.textColorsForStates[.down] = UIColor.white

button.contentColorsForStates[.normal] = UIColor.clear
button.contentColorsForStates[.up] = UIColor.red
button.contentColorsForStates[.down] = UIColor.clear

4 - You may setup scale factors for different states

button.scaleFactors[.normal] = 1
button.scaleFactors[.up] = 1.3
button.scaleFactors[.down] = 0.7

License

AnimatedRoundButton is released under the MIT license. See LICENSE for details.