更改UIView的范围,并让UICollisionBehavior对其做出反应 [英] Change bounds of UIView and have UICollisionBehavior react to it
本文介绍了更改UIView的范围,并让UICollisionBehavior对其做出反应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以更改UIView(使用UIAttachmentBehaviors附加到某些其他UIViews)的边界,并使UICollisionBehavior与UIAttachmentBehavior结合使用(例如此处的示例影片:
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)?
谢谢! 汤姆.
推荐答案
我可以使用它,但是它很hacky.我不得不从我的动画师对象中删除所有行为,然后重新添加它们.
I got this to work but it was pretty 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];
}
}
这篇关于更改UIView的范围,并让UICollisionBehavior对其做出反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文