简体   繁体   中英

UIDynamicAnimator for views with CGAffineTransform

How do you make UIDynamicAnimator to play along with a view that has a CGAffineTransform on it?

self.transform = CGAffineTransformMakeScale(0.5, 0.5); 

When running a UIDynamicAnimator, the scale is set back to normal state.

Thanks in advance

If you add the object to an animator after the size is set it should be fine. Dynamic animator reads the transform once and then only writes it after that. If you change the size afterwards, you should remove the object from behaviors, change the size and re-add it back. Or you can just add your object into a UIView and add that to animator, then you can change size of your object whenever you want and the animator won't care.

如果在添加UIDynamicAnimator之后需要更改此变换,则需要使用updateItemUsingCurrentState:通知动画制作人员它需要根据新状态更新当前动画。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM