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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:15:42+00:00 2026-06-11T14:15:42+00:00

I want to load view controller without button. I set the identifier to 10

  • 0

I want to load view controller without button. I set the identifier to 10 and tried to use

if(...){ 
//load ViewController2
UIViewController *vc = [[self storyboard] instantiateViewControllerWithIdentifier:@"10"];
[self.navigationController pushViewController:vc];
}

here is my progect http://www.sendspace.com/file/kfjhd5

whats a problem?

  • 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-06-11T14:15:44+00:00Added an answer on June 11, 2026 at 2:15 pm

    The above code in your question is fine. I know you were asking about how to do this without a button, but the problem with your demonstration was that you used a button, but didn’t properly hook it up to the IBAction. Your goNext should be defined in your .h as:

    - (IBAction)goNext:(id)sender;
    

    And the implementation should be:

    - (IBAction)goNext:(id)sender
    {
        UIViewController *vc=[[self storyboard] instantiateViewControllerWithIdentifier:@"10"];
        [self.navigationController pushViewController:vc animated:YES];
    }
    

    I presume you created that IBAction manually. In the future it’s worth noting that if you control-drag (or right-click drag) from the button down to the assistant editor file, you can automate the creation of your IBAction interfaces, and this sort of error won’t happen:

    automate creation of IBAction


    As an aside, I personally like to use a segue instead, so I first define the push segue between the view controllers themselves. In Xcode 6, one would control-drag from the view controller icon above the scene to the destination scene:

    create segue xcode 6

    In Xcode versions prior to 6, one would control-drag from the view controller icon in the bar below the scene:

    create segue

    I then select the segue in Interface Builder and give it a “storyboard identifier” (in this example, I called it pushTo10):

    specify segue id

    I then have my goNext execute that segue, rather than manually invoking pushViewController:

    - (IBAction)goNext:(id)sender
    {
        [self performSegueWithIdentifier:@"pushTo10" sender:self];
    }
    

    The advantage of that is that my storyboard now visually represents the flow of my app (rather than appearing to have a scene floating out there) and graphical elements like the navigation bar are correctly represented in the storyboard.

    You don’t have to do it this way, but it’s another alternative to be aware of.

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

Sidebar

Related Questions

I'm working on an iOS app where I want to load one view if
I want to load a web view using loadUrl that has query params in
I have a product listing page and want to load up a detail view
I want show annotation view (above one of my pin) after load map. For
at first sorry my bad English I want load model in my plugin controller
I want to load multiple languages to use IVONA SDK with SSML for iPhone.
I want to load a table view with cells. In between cells I should
I have a tabbar controller and on touching a button in one of view's
is it possible to use Spring 3.1 MVC without using a view resolver? The
I want to pass a variable from a controller to two view files. public

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.