Skip to content

Instantly share code, notes, and snippets.

@ramakser
Created February 24, 2016 09:37
Show Gist options
  • Save ramakser/f0d2f507105e20b4c305 to your computer and use it in GitHub Desktop.
Save ramakser/f0d2f507105e20b4c305 to your computer and use it in GitHub Desktop.
class IndicatorButton: UIButton {
func setExpanded(expanded: Bool) {
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDelegate(self)
UIView.setAnimationDuration(0.3)
UIView.setAnimationCurve(UIViewAnimationCurve.EaseIn)
imageView?.transform = CGAffineTransformMakeRotation(CGFloat(expanded ? -M_PI : 2 * M_PI))
UIView.commitAnimations()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment