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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:20:53+00:00 2026-06-03T21:20:53+00:00

I am attempting to use a button to go from one View (XIB) to

  • 0

I am attempting to use a button to go from one View (XIB) to another View. I’m using Xcode 4.3.2 and iOS 5. I start off by creating the project (Single View Application). I then create my button in Interface Builder, create my outlet in the header file, and my IBAction in the .m file. Next, I right clicked on my project folder in Xcode and selected “New File”. I then selected “Object-C Class” and named it “SecondViewController”. Two new files were created, “SecondViewController.h” and “SecondViewController.m”. Then I went back and right clicked on my project folder in Xcode, selected “New File” and chose “view” out of the “User Interface” options.

Now I have my empty IBAction (my button) which I want to use to go to a new view, which is called SecondViewController.xib.

If the creation of the new XIB and .h/.m files are correct up to this point, then how would I go about doing this using my button to “get to” or display my second view? Keep in mind, I’m still at a beginner level and I appreciate any help and your patience 🙂

The only differences I can tell between my main View and my SecondView are in the header files:

Main View header file:

@interface ButtonToNewViewViewController : UIViewController

Second View header file:

@interface SecondViewController : NSObject

IBAction:

-(IBAction)nextView:(id)sender
{
    // go to new view
}
  • 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-03T21:20:55+00:00Added an answer on June 3, 2026 at 9:20 pm

    This is quite a simple task that are covered by many tutorials online, but I’ll give you some help anyways. 🙂

    First of all, when you create SecondViewController, remember to create it as a subclass of UIViewController, not NSObject. So unless you have done a lot of work with those files, you can just go ahead and recreate them. At the same time you can make sure that Xcode creates the xib-file for you automatically by checking a checkbox in the creation-process.

    When you have created SecondViewController (.h, .m and .xib), open up ButtonToNewViewController.m and put #import "SecondViewController.h" at the top of the file. In your method nextView:, you can then use these two lines to change to the second view controller:

    SecondViewController *second = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    [self presentViewController:second animated:YES completion:nil];
    

    That should pop up the second view controller, with some simple animation. Make sure that the string you pass to initWithNibName: has the same name as your .xib-file.

    And if you want to go back to ButtonToNewViewController, you can use this in a method in SecondViewController:

    [self dismissViewControllerAnimated:YES completion:nil];
    

    That should clear things up a bit. 🙂

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

Sidebar

Related Questions

In attempting to use std::select1st from <functional> in a VS2008 project I found that
I'm using a Silverlight 4 dataform and attempting to use the inbuilt add button
Attempting to use the data series from this example no longer passes the JSONLint
When attempting to use HttpWebRequest to retrieve a page from my dev server, I
Im attempting to use websockets for a project. It needs to use the ipad,
I am attempting to use Cloud9 IDE for the first time, and start a
I'm attempting to use TinyXML to read and save from memory, instead of only
Using the following code I am attempting to: Test to see if one of
Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng
Im attempting to use a C++ extension for Python called PySndObj. and getting an

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.