Closed patchthecode closed 8 years ago
It doesn't look like you're setting a toValue
here — are you relying on that being a default? I wonder if that changes when you press it multiple times?
I have changed the code to have a to value of Zero (0). And I am getting the same problem. Do you have any code that i may see that has a simple flip rotation?
Here is my redone method in full. It is still failing after the 3rd click.
@IBAction func clicky(sender: UIButton) {
sender.userInteractionEnabled = false
let layer = sender.layer
// First let's remove any existing animations
layer.pop_removeAllAnimations()
layer.removeAllAnimations()
let rotation: POPSpringAnimation = POPSpringAnimation(propertyNamed:kPOPLayerRotationY)
rotation.fromValue = M_PI
rotation.toValue = 0
rotation.completionBlock = {(anim: POPAnimation! , finished: Bool) -> Void in
layer.pop_removeAllAnimations()
sender.userInteractionEnabled = true
}
layer.pop_addAnimation(rotation, forKey: "rotation")
}
Can you try copying this code and running it to see the same bug i am seeing?
I haven't tried this animation specifically before, no. My question is mostly about what you said about it working a few times — if it works once, it should work again if all the other properties on the layer are the same. Is that understanding right?
Ok i see. Yes, if i tab the button once, it flips correctly. 2nd time works as well as 3rd time. By about the 4th tap, the view begins messing up badly. I have put a question about it on stack overflow about it and someone gave me an answer yesterday. https://stackoverflow.com/questions/35251571/how-to-flip-a-uiview-horizontally-using-facebook-pop-ios-framework
It does seem to be a bug. I wonder why such a simple animation has not been fixed yet.
how to flip a view around the y axis?
With my code bwloe, the view does indeed flip for the first 4 times. Then it begins to flip in all sorts of weird angles and starts messing. If my code below correct?
Here is my code: