Say I have two view controllers: xVC and yVC. I have used the shake API and and have used the methods -(void)motionBegan
,-(void)motionEnded:
and -(void)motionCancelled
in xVC. What happens is when the device is shaken, it fires a simple animation. Now the thing is that this animation is fired even when the I have yVC open that is, when yVS.view
has been added as the subview. What I am looking for is some if condition which I can use in -(void)motionEnded:
like this:
if(yVC == nil)
{
//trigger animation
}
By that I mean that the shake shouldn't work when yVC is visible. How do I do that? Please help.