iphone - easy way to have that press -> delete effects? or move -> relocate view effect?
iphone, shake, uiview
Solution
1) You'd have to use UILongPressGestureRecognizer to detect long presses
UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(startWobbling)];
[anyView addGestureRecognizer:longPressGesture];
[longPressGesture release];
and then in the startWobbling selector do:
CGAffineTransform leftWobble = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(-5.0));
CGAffineTransform rightWobble = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(5.0));
view.transform = leftWobble; // starting point
[UIView beginAnimations:@"wobble" context:view];
[UIView setAnimationRepeatAutoreverses:YES]; // important
[UIView setAnimationRepeatCount:10];
[UIView setAnimationDuration:0.25];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(wobbleEnded:finished:context:)];
btn.transform = rightWobble; // end here & auto-reverse
[UIView commitAnimations];
2) Refer Touches sample code from Apple: http://developer.apple.com/library/ios/#samplecode/Touches/Introduction/Intro.html
Problem
On iphone's home, you can press and hold on one app for 2 secs, then everyone is shaking and waiting to be delete or relocate. How can I have this in my own view? press & hold on somewhere and every subview is shaking press & hold on somewhere so user can relocate the views? Just like iOs's home screen or ibook or quite many other apps? thanks