I am a little new to application development. In viewController (VPviewController), I have the following code:
- (void) motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{ if (motion == UIEventSubtypeMotionShake){ [self startGame:nil]; } }
In another viewController (VPgameViewController), I have another MotionShake event:
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event{ if(event.subtype == UIEventSubtypeMotionShake){ if(count < 3 ){ [self changeText:nil]; AudioServicesPlaySystemSound(1016); count++; }else{ count = 0; AudioServicesPlaySystemSound(1024); UIStoryboard *storyboard = self.storyboard; VPpoepViewController *shit = [storyboard instantiateViewControllerWithIdentifier:@"PoepViewController"]; shit.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentViewController:shit animated:YES completion:nil]; } } }
When I am in VPgameView and I shake Iphone, it also calls the startGame function, which is in another shakeController event.
How can i stop this?
source share