title: Dismissing the keyboard for a UITextField in UIAlertView
body: <p>I have a Customized UIAlertView.I have a UITextField in that AlertView, which becomes the firstResponder as soon as it is shown. Now I need to dismiss the keyboard for that UITextField when user touches somewhere else in the AlertView. I have touchesBegan event for that.</p>
  
  <p>Everything is in place and works fine, except when I call resignFirstResponder on the UITextField, it resigns from being the first responder but the keyboard is not dismissed. Is there any way to dismiss that keyboard.</p>
  
  <p>I was looking for the solutions and found a similar post <a href="https://stackoverflow.com/questions/3346023/resignfirstresponder-doesnt-dismiss-the-keyboard-iphone" title="ResignFirstResponder doesn&#39;t dismiss the keyboard (iPhone)">here</a> with no answers </p>
  
  <p>If anyone was able to find a way out please let me know. I even tried the following way, but its not working</p>
  
  <pre><code>UIWindow* tempWindow;
  
      // Because we cant get access to the UIKeyboard throught the SDK we will just use UIView. 
      // UIKeyboard is a subclass of UIView anyways
      UIView* keyboard;
  
      // Check each window in our application
      for(int c = 0; c &lt; [[[UIApplication sharedApplication] windows] count]; c ++)
      {
          // Get a reference of the current window
          tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:c];
          for(int i = 0; i &lt; [tempWindow.subviews count]; i++)
          {
              // Get a reference to the current view
              keyboard = [tempWindow.subviews objectAtIndex:i];
  
              // Loop through all views in the current window
  
              if([[keyboard description] hasPrefix:@"&lt;UIKeyboard"] == YES){
                  [keyboard removeFromSuperview];
              }
  
          }
      }
  </code></pre>