title: Is there a way to have an instance of UIView inherit from UIControl programmatically?
body: <p>In many iOS books and tutorials they demonstrate how in interface builder you can basically turn a UIView into a UIControl and have it inherit new higher level functionality to respond to clicks and behave like button for example. This is done simply by changing the class type in interface builder of a selected UIView.</p>
  
  <p>This is often done to dismiss the keyboard when someone touches on the "background" or main view of a given view controller.  Once a UIView's class is changed to a UIControl you just assign connect a new IBAction for when a TouchUpInside event occurs for example.</p>
  
  <p>Now I understand this concept but it seams like a weird Xcode hack. The reason is, I don't see how I could accomplish the same thing programatically. Let me explain:  If I create an instance of a UIView in code and I want it to behave like a UIControl how would I tell this UIView instance that I want it to inherit from UIControl.  Now keep in mind I don't actually want to subclass UIControl because that would be jumping through more hoops and I don't think that is what Interface Builder is doing when you change that class type, or is it?  Also, keep in mind UIControl is meant to be an abstract class and not to be used directly otherwise I would probably just do that.</p>
  
  <p>Ultimately my question is, is there an equivalent way to accomplish the same thing in pure code and have a UIView become a UIControl such that I can assign the higher level events to it?</p>
  
  <p>I hope this makes sense, if not I can elaborate.</p>