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

  • Home
  • SEARCH
  • 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 6128841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:40:22+00:00 2026-05-23T16:40:22+00:00

I’m fairly new to Objective-C and iPhone programming so I apologize if this is

  • 0

I’m fairly new to Objective-C and iPhone programming so I apologize if this is a newbie question. I have a simple application that needs to go from one view, to another. The first view is a UIViewController. I set up the xib file in IB (i.e. dragged some buttons onto the window) and hooked up all the buttons (which all work). I then created another xib file and class (also a UIViewController) and hooked them up. When a button is pressed in the first view I want to load the second view. Here’s the code that is supposed to be pushing the view:

-(IBAction)createAccount:(id)sender{
    CreateAccountViewController*acctView = [[CreateAccountViewController alloc] initWithNibName:@"CreateAccount" bundle:nil];
    [self.navigationController pushViewController:acctView animated:YES];
    [acctView release];
}

But this does nothing. When I put print statements in the createAccount method those are printed (I can click the button any number of times and it never crashes) but the acctView is never pushed. When I print out the value of self.navigationController it returns null. It’s even stranger because if I present the acctView modally then it works.

-(IBAction)createAccount:(id)sender{
    CreateAccountViewController*acctView = [[CreateAccountViewController alloc] initWithNibName:@"CreateAccount" bundle:nil];
    [self presentModalViewController:acctView animated:YES];
    [acctView release];

}

This works just fine, but I don’t want to use the view modally. I’m completely lost here. In the past couple of hours I’ve come across a lot of posts saying to do something with a UINavigationController and hook that up to my view, but how do I do that? Any help is greatly appreciated! Thanks.

  • 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-23T16:40:23+00:00Added an answer on May 23, 2026 at 4:40 pm

    It seems you haven’t created a UINavigationController for your app.

    Best thing would be starting from scratch with a new Xcode project, taking care of choosing a Navigation Based application. In this way you will get almost everything already set up for you.

    If you don’t like this approach, you can create programmatically your UINavigationController. Here you find a tutorial for doing that.

    If you prefer more straight-to-the-point instructions, here they are:

      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
         MainPageDialog *overviewViewController = [[MainPageDialog alloc] initWithNibName:@"MainPage" bundle:nil];
         self.navigation = [[[UINavigationController alloc] initWithRootController:overviewViewController] autorelease];
         [overviewViewController release];
    
         [window addSubview:[navigation view]];
         [self.window makeKeyAndVisible];
    
         return YES;
    }
    

    whereby self.navigation is a retained property in your appDelegate.

    EDIT:

    This answer was quite old, therefore an update:

    1. If you are using ARC, you should be using a strong (vs. retain) property and you would not need the autorelease;

    2. if you target iOS > 4.0 (which is also implied by the above point), you can use the rootViewController property in UIWindow and say:

       MainPageDialog *overviewViewController = [[MainPageDialog alloc] initWithNibName:@"MainPage" bundle:nil];
       self.window.rootViewController = [[[UINavigationController alloc] initWithRootController:overviewViewController] autorelease];
       [overviewViewController release];
      
       [window addSubview:[self.window.rootViewController view]];
       [self.window makeKeyAndVisible];
      

      without the need for any navigation property.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

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.