title: Check if a subview is in a view
body: <p>I'm making an app where I add a subview to a view using <code>addSubview:</code> on an <code>IBAction</code>. In the same way, when the button with that <code>IBAction</code> is touched again should call <code>removeFromSuperview</code> on that subview added on that <code>IBAction</code>: </p>
  
  <p><strong>PSEUDO CODE</strong></p>
  
  <pre><code>-(IBAction)showPopup:(id)sender 
  {
      System_monitorAppDelegate *delegate = (System_monitorAppDelegate *)[[UIApplication sharedApplication] delegate];
      UIView *rootView = delegate.window.rootViewController.view;
  
      if([self popoverView] is not on rootView) 
      { 
          [rootView addSubview:[self popoverView]];
      } 
      else 
      {
          [[self popoverView] removeFromSuperview];
      }
  
  }
  </code></pre>