title: Xcode: Connection Between View Controllers and App Delegate
body: <p>This is probably a noob question but can't get my head around it.</p>
  
  <p>How do i make a connection between 2 viewcontrollers or a view controller and my appdelegate?
  what i usually do is add the following to my app delegate "h" file</p>
  
  <pre><code>@class RootViewController;
  
  
  @interface TabBarWithSplitViewAppDelegate : NSObject &lt;UIApplicationDelegate, UITabBarControllerDelegate&gt; {
      RootViewController *rootViewController;
  
  
  
  }
  @property (nonatomic, retain) IBOutlet RootViewController *rootViewController;
  
  @end
  </code></pre>
  
  <p>and then create a connection in the Interface Builder. from my root view controller to the app delegate and automatically tells me thats the rootViewController that i added above.</p>
  
  <p>and if you do this on the app delegate "m" file:</p>
  
  <pre><code>#import "RootViewController.h"
  
  NSLOG(@"Controller %@",rootViewController);
  </code></pre>
  
  <p>it gives you a bunch of numbers indicating that there is a connection</p>
  
  <p>But as you know with xcode 4 this changed since you usually no longer have the main.xib where you can create the connection, you do almost all those connections programatically.</p>
  
  <p>i`ve tried everything from using the same code without the "IBOutlet" to adding:</p>
  
  <pre><code>rootViewController = [[RootViewController]alloc] init;
  </code></pre>
  
  <p>but nothing seems to work.</p>
  
  <p>can anybody help out?</p>
  
  <p>Thanks in advance</p>