title: Common View Controller Base Class
body: <p>I'd like to have a <code>BaseViewController</code> class (that inherits from <code>UIViewController</code>) for my project that can act as a base class for other view controllers in my project. This is to add things such as a common progress HUD, a refresh button &amp; network updating mechanism, perhaps an error dialog that can be customized with text by each subclass, etc.</p>
  
  <p>Crucially, I want to be able to add this functionality to both <code>UIViewController</code> subclasses AND <code>UITableViewController</code> subclasses, but I'm unable to insert myself into the <code>UITableViewController</code> class hierarchy, so effectively I need a <code>BaseUIViewController</code> and a <code>BaseUITableViewController</code>, but if I do this I have to implement the changes twice and keep them in sync.</p>
  
  <p>What's the best approach to have a single place for common code that has to be accessible both to <code>BaseViewController</code> subclasses and to <code>BaseTableViewController</code> subclasses? I only want one place in my code where I would have to deal with common tasks.</p>
  
  <p>1) I've thought about using a category with <a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocAssociativeReferences.html">associative references</a>, but the problem here is that I need to have custom implementation of the ViewController lifecycle classes such as viewDidLoad:, and it's not a good idea.</p>
  
  <p>2) I could skip <code>UITableViewController</code> entirely, and build up my own <code>BaseTableViewController</code> from a BaseViewController, implementing <code>tableView</code> <code>delegate</code> &amp; <code>datasource</code> methods myself, but I'm not so keen to skip apple's controller implementation here.</p>
  
  <p>3) I could have a <code>BaseViewController</code> inheriting from <code>UIViewController</code>, <code>BaseTableViewController</code> inheriting from <code>UITableViewController</code>, and just put custom method calls into a third file <code>ViewControllerBaseMethods</code> that can be invoked from both 'Base' files. There might still be duplication of properties, but at least the method code would be in one place.</p>
  
  <p>Any other good approaches for this type of thing?</p>