title: How do I know if a view is visible or not?
body: <p>Say I have two view controllers: xVC and yVC. I have used the shake API and and have used the methods <code>-(void)motionBegan</code>,<code>-(void)motionEnded:</code> and <code>-(void)motionCancelled</code> 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 <code>yVS.view</code> has been added as the subview. What I am looking for is some if condition which I can use in <code>-(void)motionEnded:</code> like this:</p>
  
  <pre><code>if(yVC == nil)
  {
       //trigger animation
  } 
  </code></pre>
  
  <p>By that I mean that the shake shouldn't work when yVC is visible. How do I do that? Please help.</p>