title: Getting UIView Type
body: <p>I keep seeing examples that manually iterate through all of the subviews of a certain type in a UIView.  For example, if you want a click outside of a keyboard to dismiss the keyboard regardless of which field is active, you might:</p>
  
  <pre><code>-(IBAction)backgroundClick:(id)sender
  {
      [myTextField resignFirstResponder];
      [myOtherTextField resignFirstResponder];
      // ... repeat for each of my zillion text fields.
  }
  </code></pre>
  
  <p>Instead of something like:</p>
  
  <pre><code>for(UIView *v in self.view.subviews)
      if(v.hasKeyboard) // or something like java's instanceof
          [v resignFirstResponder];
  </code></pre>
  
  <p>Although improvements to the specific case of the keyboard (such as discovering which one is first responder now) are appreciated, I'm more interested in the general case.</p>