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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:48:00+00:00 2026-06-16T20:48:00+00:00

I have a view controller that when I press a button a child view

  • 0

I have a view controller that when I press a button a child view controller appear. This works perfectly but I want to change this child view controller for other one if I press the button next that is inside of this to do like two step login.
Any idea? Because from the main view controller I know how show a child but from the child I don’t know how to do it.

  • 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-16T20:48:01+00:00Added an answer on June 16, 2026 at 8:48 pm

    If using storyboards, you can create your own child replace segue, e.g.:

    ReplaceSegue.h

    @interface ReplaceSegue : UIStoryboardSegue
    
    @end
    

    ReplaceSegue.m

    @implementation ReplaceSegue
    
    - (void)perform
    {
        UIViewController *source = self.sourceViewController;
        UIViewController *destination = self.destinationViewController;
        UIViewController *container = source.parentViewController;
    
        [container addChildViewController:destination];
        destination.view.frame = source.view.frame;
        [source willMoveToParentViewController:nil];
    
        [container transitionFromViewController:source
                               toViewController:destination
                                       duration:0.5
                                        options:UIViewAnimationOptionTransitionCrossDissolve
                                     animations:^{
                                     }
                                     completion:^(BOOL finished) {
                                         [source removeFromParentViewController];
                                         [destination didMoveToParentViewController:container];
                                     }];
    }
    
    @end
    

    You can then open your storyboard, put a container view on your container view controller and on the child controller, put a custom segue from the first child scene to the second child scene. You’ll want to specify the ReplaceSegue class for the custom segue between the two child scenes:

    container controller storyboard

    Note that if you’ve properly used autolayout or autosizing on the second child view, everything will work fine (especially with the manual setting of the frame of the destination controller’s view in the ReplaceSegue). But in Interface Builder, the layout of that second child scene doesn’t look quite right and can make the proper design of the scene a little awkward, because (as of Xcode 4.5, at least) the “Simulated Metrics” for the second child scene doesn’t do a good job inferring the the proper size. So you should probably change that second child scene’s simulated metrics’ size from “Inferred” to “Freeform” and then manually adjust the size of the second child scene:

    container storyboard with manually adjusted second child scene size

    It’s not very elegant Xcode experience, but it works. And if you’re properly using autolayout or autosizing masks, minor variations are handled very gracefully.

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

Sidebar

Related Questions

I have a view controller that houses a UIWebView. I want to display an
I know this is extremely silly. I have a view controller that scans a
I have a main view controller that consists of 1 button that when tapped,
I Have a view with a button. I want to press the button and
I have a view, and a button in this view. When I press this
I have this storyboard: When I press the Insegnante button in the first view
I have a view controller that gets presented modally and changes some data that
I have a view controller that has a tableView in it. When I set
If I have a view controller that has an NSOperationQueue as an instance variable,
In a word, how? I have a view controller that creates a few custom

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.