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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:01:20+00:00 2026-05-13T10:01:20+00:00

I am trying to understand the behavior of view controllers when switching from one

  • 0

I am trying to understand the behavior of view controllers when switching from one to another (displaying different views)

A part form the addSubiew statements which seem to work, I can’t find an explanation to what happens with the two statements:

self.view = someViewController.view;
[someViewController loadView];

In fact I got a case where only the first one seems to work (the view defined within someViewController is displayed) and in another case only the second one.

More precisely, from the root viewController.view to anotherViewController.view (already istantiated) I have to use the first one, to come back I need to use the second one.
I can’t understand what can it be the difference in the current situation which allows one or the other statement to work.

Thank you

  • 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-13T10:01:20+00:00Added an answer on May 13, 2026 at 10:01 am

    Looks like you have some misconceptions about how view controllers work.

    There are a couple things wrong with those 2 statements:

    self.view = someViewController.view;
    

    According to the docs of UIViewController.view :

    “Each view controller object is the sole owner of its view. You must not associate the same view object with multiple view controller objects.” -Apple Docs

    Once that line of code executes, the view would have 2 different controllers, which is bad.

    Next line:

    [someViewController loadView];
    

    This is bad because you should never explicitly call loadView.

    From the docs of UIViewController.loadView :

    “You should never call this method directly.”

    From the docs of UIViewController.view :

    “If you access this property and its value is currently nil, the view controller automatically calls the loadView method and returns the resulting view. “

    Spend some time with the viewController tutorials and guides such as “View Controller Programming Guide for iPhone OS”. They are good docs and can teach a lot.

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

Sidebar

Related Questions

I'm trying to understand a particular Perl code from vcake . Usually I find
Trying to understand an fft (Fast Fourier Transform) routine I'm using (stealing)(recycling) Input is
After trying to understand why client code is not rendered in a page (injected
I've been trying to understand how Ruby blocks work, and to do that I've
I've been trying to understand Process.MainWindowHandle . According to MSDN; The main window is
I'm trying to understand someone else's Perl code without knowing much Perl myself. I
I am trying to understand some assembly. The assembly as follows, I am interested
I was trying to understand something with pointers, so I wrote this code: #include
I'm trying to understand the concepts behind DDD, but I find it hard to
I'm trying to understand how you are supposed to add page numbers to the

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.