2016-07-19 27 views

Antwort

0

Das Update auf diesen Fehler ist ein CABasicAnimation auf der Schicht, keine CGAffineTransformMakeRotation auf der Ansicht der Schaltfläche anzuwenden.

Aus irgendeinem Grund, wenn Sie es auf die Ansicht anwenden, verwirrt es mit dem Rahmen und AutoLayout. Weitere Informationen here.

Hier ist, wie dieses Update zu implementieren:

let animation = CABasicAnimation(keyPath: "transform.rotation") 
animation.autoreverses = false 
animation.duration = 0.3 
animation.fromValue = 0 
animation.fillMode = kCAFillModeForwards 
animation.removedOnCompletion = false 
animation.toValue = 3.14/4 // 45 degrees 
self.myButton.layer.addAnimation(animation, forKey: "45rotation")