Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6105521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:58:52+00:00 2026-05-23T13:58:52+00:00

This is probably a noob question but can’t get my head around it. How

  • 0

This is probably a noob question but can’t get my head around it.

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

@class RootViewController;


@interface TabBarWithSplitViewAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
    RootViewController *rootViewController;



}
@property (nonatomic, retain) IBOutlet RootViewController *rootViewController;

@end

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.

and if you do this on the app delegate “m” file:

#import "RootViewController.h"

NSLOG(@"Controller %@",rootViewController);

it gives you a bunch of numbers indicating that there is a connection

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.

i`ve tried everything from using the same code without the “IBOutlet” to adding:

rootViewController = [[RootViewController]alloc] init;

but nothing seems to work.

can anybody help out?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:58:52+00:00Added an answer on May 23, 2026 at 1:58 pm

    You will basically want to create an ivar of your view controller in your app delegate.

    ViewController *myVC;
    @property (nonatomic, retain) IBOutlet ViewController *myVC;
    

    then synthesize it in the implementation file.

    Then when the view controller loads, call something along the lines of this:

    - (void)viewDidLoad {
        AppDelegateClass *appDelegate = (AppDelegateClass *)[[UIApplication sharedApplication] delegate];
        appDelegate.myVC = self;
    }
    

    At this point, you now have a direct connection to your view controller from the app delegate. Similarly, you could do the opposite to call app delegate methods from the view controller. In that case, you’d set up a delegate in the view controller’s header.

    id delegate;
    @property (nonatomic, assign) id delegate;
    

    again synthesizing it in the implementation file.

    Now when you are in viewDidLoad, you’d call something like this:

    - (void)viewDidLoad {
        self.delegate = (AppDelegateClass *)[[UIApplication sharedApplication] delegate];
    }
    

    That should give you what you need to get going, so I hope that helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a noob question that I will get slated for but here
This is probably a noob question, but I can't seem to find the answer.
This is probably a noob question but I've been trying to figure it out
This is probably a noob question, but how I've implemented the appendTo() function below
sorry for the (probably) noob question, but I', new at this stuff. i have
This is probably a java noob question but here is my scenario: using selenium,
I understand that this is a probably a noob-ish question, but I've had no
This surely is a noob question, but I can't find an answer in Doxygen
This is probably a really noob question, but the fact of the matter is
This is probably a really dumb/noob like question but what is the best method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.