title: Why do I seemingly have to typecast window.rootViewController in iOS app delegate?
body: <p>I have a fairly simple iOS 5 app at this point. </p>
  
  <p>A UINavigationController is set as the initial view controller in Interface Builder (do we still call it Interface Builder? anyways...). The UINavigationController has as its rootViewController a generic UITabBarController.</p>
  
  <p>I want to use the main AppDelegate for both the UINavigationController and UITabBarController delegate's. I've made the AppDelegate conform to both the UINavigationControllerDelegate and UITabBarControllerDelegate. Everything works well. BUT!</p>
  
  <p>In AppDelegate's application:didFinishLaunchingWithOptions:, I feel like I'm doing something hacky. I'm having to typecast self.window.rootViewController, and self.window.rootViewController.topViewController in order to set each controllers delegate. </p>
  
  <pre><code>UINavigationController *rootNavigationController = (UINavigationController *) self.window.rootViewController;
  UITabBarController *rootTabBarController = (UITabBarController *) rootNavigationController.topViewController;
  [rootNavigationController setDelegate:self];
  [rootTabBarController setDelegate:self];
  </code></pre>
  
  <p>If I don't typecast self.window.rootViewController I can't set it's delegate. Same for the topViewController (UITabBarController). </p>
  
  <p>If I've declared in Inferface Builder that the initial view is a UINavigationController, and not some generic UIViewController, why must I still typecast everything? Is this hacky?</p>