ios - Want to make rotating button which I can press while animating -
i've made rotating button. while button rotates can't press it. question how can make "pressable"? animation code is:
var max: bool = true func startanimation() { max = !max let duration: double = 1 let fullcircle = 2 * m_pi let upordown = (max ? cgfloat(-1 / 16 * fullcircle) : cgfloat(1 / 16 * fullcircle)) let scale: (cgfloat, cgfloat) = (max ? (1.0, 1.0) : (1.3, 1.3)) uiview.animatewithduration(duration, animations: { () -> void in let rotationanimation = cgaffinetransformmakerotation(upordown) let scaleanimation = cgaffinetransformmakescale(scale) self.startbutton.transform = cgaffinetransformconcat(rotationanimation, scaleanimation) }) { (finished) -> void in self.startanimation() }
so if press button there no effect has happened. no text inside button text animation - nothing! button keep rotating , don't perform segue other scene. if no animation can segue.
use animation option uiviewanimationoptionallowuserinteraction.
uiview.animatewithduration(duration, delay:, options: uiviewanimationoptions.allowuserinteraction, animations: , completion: )
Comments
Post a Comment