I have several UIImageViews
within a UIScrollView
that I want to wiggle when the user long-presses one of them. So similar to the behavior you get when you long-press an icon in your iPad/iPhone menu.
So I have the following:
- (void)startWiggling {
for (UIImageView *touchView in [scrollView subviews]) {
[UIView beginAnimations:@"wiggle" context:nil];
[UIView setAnimationDuration:0.1];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:FLT_MAX];
//wiggle 1 degree both sides
touchView.transform = CGAffineTransformMakeRotation();
touchView.transform = CGAffineTransformMakeRotation(-0.0174532925);
[UIView commitAnimations];
}
}
- (void)stopWiggling {
NSLog(@"Stop wiggling");
}
This works fine. The issue is... How can I make it stop wiggling after the user has pressed a button? I have a button and connected it etc and it's reaching the stopWiggling
method, so that's fine. But so...
- How do I remove the UIView animation from these
UIImageViews
? - Can I bind this action to the user pressing the home button on their device?
then
or