I've been digging through some UIDynamics examples and I've checked out some of the WWDC videos, but I'm still a bit lost on how I'd replicate that bounce on the lock screen. I'd like to "bounce" the contentView of a UIView on tap. There's a swipe gesture when you can push up to reveal a button drawer but, I'd like to integrate some UIDynamics. Also, how would I set the boundaries of the UIDynamics behavior? The contentView would need to lock into place when the user has swiped up a certain distance. Thanks for any tips.
I don't have a project to work on this with but the following will take a UIButton
and when you click on it, drop it to the bottom of the view, and it will bounce.
- (UIDynamicAnimator *)animator
{
if (!_animator) {
_animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];
}
return _animator;
}
- (IBAction)clicked:(id)sender {
UIGravityBehavior *gravity = [[UIGravityBehavior alloc] initWithItems:@[self.button1]];
UICollisionBehavior *collision = [[UICollisionBehavior alloc] initWithItems:@[self.button1]];
collision.translatesReferenceBoundsIntoBoundary = YES;
[self.animator addBehavior:collision];
[self.animator addBehavior:gravity];
}
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.