[英]Change bounds of UIView and have UICollisionBehavior react to it
Is it possible to change the bounds of a UIView (which is attached to some other UIViews using UIAttachmentBehaviors) and have the UICollisionBehavior in combination with the UIAttachmentBehavior respond to it (like the sample movie here: http://www.netwalkapps.com/ani.mov , whereby upon touch the ball UIView grows and the other ball UIViews move out of the way)? 是否可以更改UIView的边界(使用UIAttachmentBehaviors附加到其他一些UIViews)并将UICollisionBehavior与UIAttachmentBehavior结合使用(如下面的示例电影: http : //www.netwalkapps.com/ ani.mov ,在接触球时,UIView成长,另一球UIViews移开)?
Thanks! 谢谢! Tom. 汤姆。
I got this to work but it was pretty hacky. 我得到了这个工作,但它非常hacky。 I had to remove all behaviors from my animator object and re-add them again. 我不得不从动画师对象中删除所有行为并重新添加它们。
- (void)_tickleBehaviors
{
NSArray *behaviors = [self.animator.behaviors copy];
for (UIDynamicBehavior *behavior in self.animator.behaviors) {
[self.animator removeBehavior:behavior];
}
for (UIDynamicBehavior *behavior in behaviors) {
[self.animator addBehavior:behavior];
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.