title: iOS: UITabBarController - lazy loading of item views
body: <p>I have read that subclassing a UITabBarController is a non-recommended practice. However, how then is possible to implement lazy loading of the views of tab bar items? </p>
  
  <p>I'm playing around with a standard app view hierarchy: In my main app delegate file (application:didFinishLaunchingWithOptions:) , I'm instantiating a custom subclass of UITabBarController with a 4 tab bar items / icons. I only need to load the first view of the first tab bar item - other views should be loaded lazily upon request. So, in application:didFinishLaunchingWithOptions:, I'm loading welcome view and pushing it into the first UINavigationController(1). The other tab bar items are empty UINavigationControllers - (2, 3, 4). Here is my custom subclass of UITabBarController that is also a delete of himself:</p>
  
  <pre><code>@interface MainUITabBarController : UITabBarController &lt;UITabBarControllerDelegate&gt; {
  }
  @end
  
  @implementation MainUITabBarController
  -(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{
     UIImageView *image = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TableViewBG.jpg"]] autorelease];
     UIViewController *vc = [self.viewControllers objectAtIndex:item.tag];
     vc.view = image;
  }
  @end
  </code></pre>
  
  <p>Currently, the view of the second tab bar item is just a UIViewController but I it will become a UINavigationController soon :)</p>
  
  <p>So, back to the problem, what other (more apple-complaint) options would be to implement tab bar item action handling for lazy-loading?</p>