UIView animation clips view bounds. Any way to pre

2019-07-20 16:07发布

问题:

I have a UIView animation that does a vertical flip animation transition from one view to another. The problem is that the view has some overflowed content (achieved by setting clipsToBounds to NO on the view), and during the animation, the overflowed content gets clipped.

Is there any way to prevent CoreAnimation from clipping the views?

Screenshots

Normal view (notice the paperclip and overhanging rope along the top edge of the map):

Animation in flight: (paperclip and rope are clipped)

回答1:

I'd recommend placing all the views which rotate inside of a transparent view (kind of placeholder for "map" and "clip"), and applying animation to it rather than to your map view.

Try to set placeholder view's size the way its subviews won't overflow, so you can not worry about hacking clipsToBounds.



回答2:

have you tried: myView.layer.masksToBounds = NO; ?