Subclass UIButton with different states
var stateButton : StateButton!
stateButton.titles = ["facebook"]
stateButton.images = [UIImage(named: "icon_login_facebook")!, UIImage(named: "icon_login_twitter")!, UIImage(named: "icon_login_mail")!]
stateButton.titleColors = [UIColor.redColor(), UIColor.greenColor(), UIColor.blueColor()]
stateButton.closures = ([ { (index) -> () in
println("State \(index)")
},
{ (index) -> () in
println("State \(index)")
},
{ (index) -> () in
println("State \(index)")
}])
stateButton.transitions = [(kCATransitionPush, kCATransitionFromTop), (kCATransitionMoveIn, kCATransitionFromLeft), (kCATransitionReveal, kCATransitionFromRight)]
Use cocoapods
pod 'StateButton'
MIT