This is how I solved my problem.
First I added: @property BOOL isInTransit;
Then I added the viewDidAppear
method to my code, and set isIntransit
to true
(viewDidAppear will be called after the transitions has ended.)
-(void)viewDidAppear:(BOOL)animated
{
self.isInTransit = true;
}
Finally I added an if statement to my motionBegan
method, and set isInTransit to false just before preformeSegueWithIdentifier
is called:
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if (event.subtype == UIEventSubtypeMotionShake)
{
if (self.isInTransit){
self.isInTransit = false;
[self performSegueWithIdentifier:@"DetailViewSeque" sender:self];
}
}
}
Thanks to Armand DOM for helping me out.