title: iOS How to dismiss UIAlertView with one tap anywhere?
body: <p>I want to dismiss UIAlertView anywhere outside it with one tap. I want to show a UIAlertView without any button. </p>
  
  <p>I have standard UIAlertView codes here, but I need input how to dismiss it, if it is possible.</p>
  
  <p>With UITouch? With UITapGestureRecognizer?</p>
  
  <p>Thank you.</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>in viewDidLoad</p>
  
  <p>alertview initialization here with name "alert"</p>
  
  <pre><code>     if (alert)
       {
      emptyview = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,480)];
      emptyview.backgroundColor = [UIColor clearColor];
      [self.view addSubview:emptyview];
           [emptyview addSubview:alert];
      NSLog (@"emptyview is there!");
  
           UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
           [emptyview addGestureRecognizer:singleTap];
           [singleTap release];            
       }
  </code></pre>
  
  <p>But this emptyview doesnt not respond at all and it does not respond to handleSingleTap selector, which I rewrote a bit:</p>
  
  <pre><code>-(void)handleSingleTap:(UITapGestureRecognizer *)sender{
      [alert dismissWithClickedButtonIndex:0 animated:YES];
      [emptyview removeFromSuperview];
  }
  </code></pre>
  
  <p>I need this emptyview being upon alert when alert is shown then I can dismiss alert with one tap.</p>
  
  <p>I tried:</p>
  
  <pre><code>     if (alert)
       {
      emptyview = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,480)];
      emptyview.backgroundColor = [UIColor clearColor];
      [self.view addSubview:emptyview];
           [emptyview addSubview:alert];
      NSLog (@"emptyview is there!");
  
           UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
           [alert addGestureRecognizer:singleTap];
           [singleTap release];            
       }
  </code></pre>
  
  <p>Of course, alert did respond to handleSingleTap function. What did I wrong with emptyview?</p>
  
  <hr>
  
  <p>SECOND EDIT:</p>
  
  <p>What I want to achieve in this case is to show a small view with explanation after selecting a word, similar function in Kindle app, if you have one. 
  Maybe I should create a UIView instead of UIAlertView? But the small view in Kindle app is so nice with shadow below it, how is it possible?</p>