Possible Duplicate:
How do i put a void(shake gesture) inside a IBAction(button)?
Hello I am creating a app, and I need help. I have asked this question 2 times before but I am not getting the right answer, it either docent work or the person dosen't realise that I am a total beginner. So before answering please explain the answer because I am very new to Xcode. So I have a button saying play, and currently when you click on it a animation appears smoothly and then ends. What I need to change is when the user press's play, a label saying shake the device to start. Then when the user shake's the device the label disappears and the animation plays and end, this is what I have so far in my viewcontroller.m file:
-(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];
}
By the way, the IBAction:startanimation is the action when the user press's the button 'play'
Please consider I am a beginner to coding, and if you have any questions feel free to ask, THanks!