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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:18:44+00:00 2026-06-02T06:18:44+00:00

I have 2 view controllers in my project. Inside View Controller1 I want to

  • 0

I have 2 view controllers in my project. Inside View Controller1 I want to switch to View Controller 2 by press of a button. Currently I do this

- (IBAction)startController2:(id)sender {

viewController1 vc2 = [[viewController2 alloc] init];
self.view = vc2.view;
}

This seems to work fine, but there is a big delay (4 secs) between the button press and second view controller appears. If I call the viewController2 directly from the AppDelegate things load faster. What am I doing wrong here. Any help is greatly appreciated.

  • 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-02T06:18:46+00:00Added an answer on June 2, 2026 at 6:18 am

    Several things to consider.

    Part 1: “What am I doing wrong here”?

    1. You definitely didn’t mean to do self.view = vc2.view. You just put one view controller in charge of another view controller’s view. What you probably mean to say was [self.view addSubview:vc2.view]. This alone might fix your problem, BUT…

    2. Don’t actually use that solution. Even though it’s almost directly from the samples in some popular iPhone programming books, it’s a bad idea. Read “Abusing UIViewControllers” to understand why.

    Part 2: What you should be doing

    It’s all in the chapter “Presenting View Controllers from Other View Controllers”.

    It’ll come down to either:

    • a UINavigationController, (see the excellent Apple guide to them here) and then you simply [navigationController pushViewController:vc2]

    • a “manually managed” stack of modal view controllers, as andoabhay suggests

    • explicitly adding a VC as child of another, as jason suggests

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

Sidebar

Related Questions

I have two view Controllers in my project ViewController , SettingsView . Here I
I have a UIScrollView in my project. I have a view controller I would
I have a Java project that I'm trying to implement with a model-view-controller design.
Currently using Xcode 4.2 and I have two view controllers (1 and 2). I
So I have two view controllers in my iphone project - one of them
In MVC 3 project, I have a Controller action that returns a View. Let's
I have a fairly hefty project, where I am loading a few view controllers,
I have a project which has a view controller as initial screen and then
Hi i have a created an another project inside my application. Now i want
I have two view controllers in a tabbar which can both edit data. Therefore,

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.