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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:01:51+00:00 2026-05-21T23:01:51+00:00

Can I load a UiViewController in a UIView in another UIViewcontrller. suppose UIViewControllerA has

  • 0

Can I load a UiViewController in a UIView in another UIViewcontrller.

suppose UIViewControllerA has a UIView named subuiview. Can I load UIViewControllerB into subbuiview?

Thanks!

  • 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-05-21T23:01:52+00:00Added an answer on May 21, 2026 at 11:01 pm

    Starting with iOS 5

    “Container view controllers” have been added in iOS 5. You can add a view controller as a child of another one with addChildViewController:.
    You also are responsible for adding its view to its parent’s view.

    Everything is well documented in the iOS SDK documentation: Implementing a Custom Container View Controller.

    To add a child view controller:

    childViewController.frame = ...
    [self.view addSubview:childViewController.view];
    [self addChildViewController:childViewController];
    [childViewController didMoveToParentViewController:self];
    

    and to remove it:

    [self willMoveToParentViewController:nil];
    [self.view removeFromSuperview];
    [self removeFromParentViewController];
    

    Prior to iOS 5

    It’s possible to load another view controller and add its view as a subview of another controller’s view.

    UIViewController *subController = ...
    [self.view addSubview:subController.view];
    

    Although it’s not recommended by Apple’s guidelines:

    Each custom view controller object you
    create is responsible for managing all
    of the views in a single view
    hierarchy. […] The one-to-one
    correspondence between a view
    controller and the views in its view
    hierarchy is the key design
    consideration. You should not use
    multiple custom view controllers to
    manage different portions of the same
    view hierarchy.

    (from the View Controller Programming Guide)

    Your sub-controller won’t receive rotation events, or viewWillAppear, viewWillDisappear, etc (except viewDidLoad).

    So Apple advises us to use a single view controller managing the entire view hierarchy (but doesn’t forbid to use multiple ones).

    Each view may still be a custom subclass of UIView. Maybe you don’t need another view controller but rather a custom view.

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

Sidebar

Related Questions

Can some explain how to properly subclass a UIViewController and then load it into
I am wondering how I can load a byte array into a memory URLClassLoader?
What is the maximum size of a DataTable I can load into memory in
I have a UIViewController that I want to load from a NIB that has
The following files load a series of shapes into a UIViewController. Each shape is
I can load the Color contents of the Current Window using GetDIBits but i
I can load COM DLLs that are registered on my machine like this: Type
I know we can load a Object from .class file and my question is
Apache Pig can load data from Hadoop sequence files using the PiggyBank SequenceFileLoader :
How can I link the array Buttons to intents so I can load up

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.