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 6534831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:17:55+00:00 2026-05-25T10:17:55+00:00

Basically, I have two view controllers inside the MainWindow.xib that can be viewed by

  • 0

Basically, I have two view controllers inside the MainWindow.xib that can be viewed by clicking the Bar Button in my Navigation Controller. I wanted those two view controllers to be separated from the MainWindow.xib with their own header, implementation and xib files and still make Navigation Controller inside of MainWindow.xib work in them.

To better understand it, please see the codes below:

Thanks a lot!

TestAppDelegate.h

#import <UIKit/UIKit.h>

    @interface TestAppDelegate : NSObject <UIApplicationDelegate>
    {
        //Navigation Controller
        IBOutlet UINavigationController *navigationController;


        //View Controllers
        UIViewController *viewController;
        UIViewController *viewController2;
        UIViewController *viewController3;

    }

    @property (nonatomic, retain) IBOutlet UIWindow *window;

    //Navigation Controller
    @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;


    //View Controllers
    @property (nonatomic, retain) IBOutlet UIViewController *viewController;
    @property (nonatomic, retain) IBOutlet UIViewController *viewController2;
    @property (nonatomic, retain) IBOutlet UIViewController *viewController3;


    - (IBAction)next;
    - (IBAction)next2;


    @end

TestAppDelegate.m

#import "TestAppDelegate.h"

@implementation TestAppDelegate

@synthesize window = _window;

//Navigation Controller
@synthesize navigationController;

//View Controllers
@synthesize viewController;
@synthesize viewController2;
@synthesize viewController3;


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

    //Navigation Controller
    [self.window addSubview:[navigationController view]];
    [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{

}

- (void)applicationDidEnterBackground:(UIApplication *)application
{

}

- (void)applicationWillEnterForeground:(UIApplication *)application
{

}

- (void)applicationDidBecomeActive:(UIApplication *)application
{

}

- (void)applicationWillTerminate:(UIApplication *)application
{

}

- (void)dealloc
{

    [viewController release];
    [viewController2 release];
    [viewController3 release];

    [navigationController release];
    [_window release];
    [super dealloc];
}


- (IBAction)next {
    [navigationController pushViewController:viewController2 animated:YES];
}


- (IBAction)next2 {
    [navigationController pushViewController:viewController3 animated:YES];
}


@end

Inside MainWindow.xib:

http://i52.tinypic.com/10xa45f.png

  • 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-25T10:17:56+00:00Added an answer on May 25, 2026 at 10:17 am

    I normally don’t touch MainWindow.xib. I suggest the following:

    1. Create a MainController which will be your MainView that subclass UIViewController by going to File > New > New File. That will create a .h/.m and nib file for each ViewController. There add whatever UI you want for your app. For Example, add two buttons and wire those buttons to IBActions in your MainController. This should be declared and implemented in your MainController.{h/m}, respectively.

    2. After that create another two ViewControllers, the same way.

    3. The body of those IBActions should create an instance of the your ViewControllers and then push them.

    It would look something like this:

    YourViewController *yvc = [[YourViewController alloc] init];
    [self.navigationController pushViewController:yvc animated:YES];
    [yvc release];
    

    Finally, you have to push the MainController in your AppDelegate and add your NavigationController to the view.

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
         MainViewController *mvc = [[MainViewController alloc] init];
         UINavigationController *unvc = [[UINavigationController alloc] init];
         [unvc pushViewController:mvc animated:NO];
         [mvc release];
         [self.window addSubview:unvc.view];
         [self.window makeKeyAndVisible];
         return YES;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIPopoverController with two view controllers inside of it. I'm building it
I have two action methods that are conflicting. Basically, I want to be able
I have a web site with two routes. Basically the user can do one
What would be the best way to share code between two view controllers that
I have two views. The User view has some text and a button. I
So I have two view controller that I load on the app delegate when
I have two modules that should over ride other urls, basically /management/category/edit/id/1 (Edit Category
I have two buttons in a list view that adjust the position of that
If I were to select a row from a table I basically have two
Basically you have two ways for doing this: for (int x = 0; x

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.