swift: translation animation on rotated view

时间:2016-03-02 10:50:24

标签: swift animation uiview rotation translation

I have a UIImageViewthat is upside down. Then I want to apply a translation animation to this view. The problem is when the view is rotated, The view doesn't appear on screen, but when I remove the line that aplies the rotation before the animation, everything works fine. I don't understand why would the view not even show up.

view.transform = CGAffineTransformMakeRotation(CGFloat(M_PI))
UIView.animateWithDuration(rocketAnimationDuration, delay: 0.0, options: [], animations:
    {
        rocket.transform = CGAffineTransformConcat(rocket.transform, CGAffineTransformMakeTranslation(0, translationY))
    }, completion: nil)

If I remove the first view, the view shows up and is animated. If I place the first line into the brackets, the views shows up and is animated (with the rotation).

Any idea why does this happen? Thanks

EDIT: I managed to make it work without applying a rotation on the UIImageView by adding a mirror effect on the UIImage. But I'd like to understand why does this problem happen when a rotation has been applied before...

0 个答案:

没有答案