我的观点有一些尺度上的转变。当我在其上应用一些 UIKit Dynamics 时,它会将它们归零。 /:
如何在视图上保留现有的转换,同时使其跳转? :P
谢谢。 :)
看看 UIDynamicAnimator 的updateItemUsingCurrentState https://developer.apple.com/LIBRARY/IOS/documentation/UIKit/Reference/UIDynamicAnimator_Class/Reference/Reference.html#//apple_ref/occ/instm/UIDynamicAnimator/updateItemUsingCurrentState%3a.
动态动画师会自动读取您添加到其中的每个动态项目的初始状态(位置和旋转),然后负责更新项目的状态。如果你将动态项目添加到动态动画制作器后主动更改其状态,调用此方法要求动画师读取并合并新状态。
因此,在将要转换的项目添加到动画制作器后,只要您更改转换,只需调用updateItemUsingCurrentState
就在之后。
id <UIDynamicItem> dynamicItem; // whatever your item is, probably a UIView
UIGravityBehavior *behavior = [[UIGravityBehavior alloc] initWithItems:@[dynamicItem]];
UIDynamicAnimator *animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; // or however you're getting your animator
[animator addBehavior:behavior];
view.transform = CGAffineTransformMakeScale(1.5, 1.5);
[animator updateItemUsingCurrentState:view];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)