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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:26:03+00:00 2026-06-09T22:26:03+00:00

I am completely new to iOS development and still have not managed how to

  • 0

I am completely new to iOS development and still have not managed how to accomplish such an easy task.

I have a raw xCode 4.4.1 “Single View Application” project.

I want to have, say, four screens, each having buttons for switching to other views.

Screens are not set up in a hierarchy: for example, I want to be able to switch to screen 2 or screen 3 from screen 1, to screen 4 from screen 2, and so on. On application run – the first screen is shown, but its status is not “root” or “main” – it is just a common screen among others.

My conditions are:

  1. I have just default main storyboard file (xib solutions are not fine).
  2. I don’t want to rely on using Navigation controllers or similar pre-structured things.

It seems to me, that I need to somehow setup Container controller with child controllers as they are described in Session 102 from WWDC 2011, but I don’t understand how to write up the code properly, so it will not conflict with main Storyboard (I have two failed attempts to use xib-based solutions from other similar topics here on SO).

I would highly appreciate a complete working example, because of my experience does not yet allow me to rely on partial hints, though they will be fine too.

A solution that will do this programmatically (not using xCode UI features like dragging) is preferred.

Thanks!

UPDATE: When switching, I don’t want to instantiate new screens each time, but re-use existing ones, if they already exist.

UPDATE 2: My use case, simplified for this issue:

I have a registration screen, with corresponding modal screens to handle all common login/logout/etc situations. And I have main screen of my app, which becomes the “main” app screen after login/registration procedure is finished. I don’t want to make registration screen/controller to be modal for the main screen, because the main screen pretty much depends on user-specific information, so I would like to have these screens not organized in hierarchy in any way. I think about having the following flow for this simplified situation:

1) User is not yet logged in – registration screen is presented. Later, after reg. procedure is done – switch (this is a key point I am not aware about, that is why this issue) to “main” screen.

2) User is logged in and is recognized by app – “main” screen is presented.

Having registration and “main” screens like I described excludes (or what?) the situation of having “Tab controller” functionality in “Tabbed application” template as is, because in my case I want to have tab bar completely disabled – what I need is not a nav. & nav bar functionality, but just the way to perform transition beetween reg. and “main” screens – this is what I mean “by hands” in my question.

FINAL UPDATE:

After experimenting with Tab Bar Controller, for this use-case I’ve ended up using Navigation Controller with navigation bar disabled (I didn’t find analogous one in Tab bar controller) and managing the switching of screens by performSegueWithIdentifier method as well as switching them by manipulating viewControllers navigation stack “by hands”.

Thank you all for answers!

  • 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-09T22:26:03+00:00Added an answer on June 9, 2026 at 10:26 pm

    Probably the easiest thing to do is use segues in the storyboard.

    right-click-drag from your main view controller to each of the others. It will ask what type of segue to create, and choose modal.

    Then, make sure you give each of the segues a unique identifier string in the identifier property.

    Now, from code, anytime you want one of those view controllers to become active, you call

    [self performSegueWithIdentifier:@"Foo Segue" sender:(id)sender];
    

    The sender object above can be anything you want, usually some information you want to pass o the view controller that is getting ready to be displayed.

    Now, just before a segue is shown, whether programmatically or directly from storyboard defined interaction, the prepareForSegue method is called. So, you would then do something like this, again in the code for the “main” view controller.

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
        // You have access to the view controller that is getting ready to be
        // displayed, as well as the identifier, so you can set values or whatever
        // before the view controller is presented.
        if ([segue.identifier isEqualToString:@"Foo Segue"]) {
            FooViewController *vc = segue.destinationViewController;
            // The view controller is completely instantiated, and you can do any
            // setup work, like setting property values on the view controller
            // to give it its model, or whatever else you want to do.
        }
    }
    

    Now, you need some way to know when that controller is done. This can be done several ways. The presented view controller can dismiss itself, or can use a delegate or notification to tell the presenting view controller that is is done and should be dismissed.

    In your case, it may well be fine to let the presented VC dismiss itself. So, just call

    [self dismissViewControllerAnimated:YES completion:nil];
    

    If you do not want to use segues, you can will have to load your VCs directly from the storyboard (or give them their own nib). To instantiate from the storyboard, you have to give the view controllers you want to instantiate their own identifier tag (again look in the property pane and set the property on the VC).

    Then you can do this (assuming the VC that houses this code is in the same storyboard as the VC it is trying to instantiate)…

    FooViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"FooViewController"];
    

    Then, you actually present that controller with…

    [self presentViewController:vc animated:YES completion:nil];
    

    Of course, there are several other ways to do this, and there are a few pros/cons on each approach. I suggest you play with it and read the associated documentation so you can make an educated decision about which method to use.

    In any event, the above should give you a somewhat easy path toward your goal.

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

Sidebar

Related Questions

I am completely new to Xcode and iOS developing in general. Basically I have
I am completely new to iOS development so I may be doing this wrong
I am completely new to iOS development and I want to load another view
I am very new to IOS programming. I have a task to find if
I am completely new to iOS development (I'm a .NET dev). I am experimenting
I'm an experienced iOS developer but have not touched OSX development. I plan to
I am completely new to ios development and I am only interested in developing
First off, I am completely new to iOS development, so I hope there is
I'm new to the whole iOS development thing but I have completed my first
I am very new to iOS development, very excited though. I have built 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.