title: How to Hide a Child View From Parent View when touch outside of Child View in iOS?
body: <p>i am newbie in iOS i make an app that contain Two Views i want to make when Button Was Pressed then Popup Child View so for this i write a cod e like as</p>
  
  <pre><code>-(IBAction)mapButtonPressed:(id)sender
   {
  self.mapTypeVIew.hidden=FALSE;
   }
  </code></pre>
  
  <p>and in my <code>viewDidLoad</code> method i write as</p>
  
  <pre><code>[self.mkMapView addSubview:self.mapTypeVIew];
  self.mapTypeVIew.hidden=TRUE;
  </code></pre>
  
  <p>so it was hide on <code>viewDidLoad</code> method and only shown when button pressed but here i want when button was pressed and subView is also Shown but i want if user touch outside of subview then subview is also hide for that i write a cod like as</p>
  
  <pre><code>- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event  {
  NSLog(@"touches began");
  UITouch *touch = [touches anyObject];
  if(![touch.view isKindOfClass:[self.mapTypeVIew class]])
  {
      self.mapTypeVIew.hidden=TRUE;
  }
  }
  </code></pre>
  
  <p>But it is Not hidden please give me Solution for when user touch outside of Child view then it was hide.</p>
  
  <p>thanks.</p>