Possible Duplicate:
How do i put a void(shake gesture) inside a IBAction(button)?
I am a beginner at creating apps and I am currently working on a project with a animation. So far i have a button and when the user press's the button a animation plays and ends. But I need help, because i need the user to shake the iPhone after he presses play. This is what i exactly need when user press's play a uilabel shows saying shake to play once the user shake's the iPhone the uilabel disappears and the animation play's. Here what I have so far: -(IBAction)startanimation {
animation.animationImages= [NSArray arrayWithObjects:
[UIImage imageNamed:@"Frame0.png"],
[UIImage imageNamed:@"Frame1.png"],
[UIImage imageNamed:@"Frame2.png"],
[UIImage imageNamed:@"Frame3.png"],
[UIImage imageNamed:@"Frame4.png"],
[UIImage imageNamed:@"Frame5.png"],
[UIImage imageNamed:@"Frame6.png"],
[UIImage imageNamed:@"Frame7.png"],
[UIImage imageNamed:@"Frame8.png"],
[UIImage imageNamed:@"Frame9.png"],
[UIImage imageNamed:@"Frame10.png"],
[UIImage imageNamed:@"Frame11.png"],
[UIImage imageNamed:@"Frame12.png"],
[UIImage imageNamed:@"Frame13.png"],
[UIImage imageNamed:@"Frame14.png"],
nil];
[animation setAnimationRepeatCount:1];
animation.animationDuration = 1;
[animation startAnimating];
button.hidden = 1;
animation.hidden = 0;
Menu.hidden = 0;
replay.hidden = 0;
}
and this is what i plan to put in:
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (event.subtype == UIEventSubtypeMotionShake)
Thank you i am a total beginner so please explain with instructions, thank you! :)