Skip to content

zyfu0000/StateButton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StateButton

Subclass UIButton with different states

StateButton

How to use

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)]

Installation

Use cocoapods

pod 'StateButton'

License

MIT