简体   繁体   中英

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)?

Thanks! Tom.

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];
    }
}

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