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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:39:03+00:00 2026-05-19T17:39:03+00:00

I just came across something that I have not seen before and I thought

  • 0

I just came across something that I have not seen before and I thought I would ask here to verify the cause. I have a UIController who’s view is defined programatically, I noticed today that when I commented the code out of its loadView (to test something else) that both loadView and viewDidLoad were both called four times. My thinking is that because I have not set the view property iOS is trying multiple times to load the view, although I am still a little curious if this is the case why viewDidLoad was also called.

- (void)loadView {
    NSLog(@"%s", __PRETTY_FUNCTION__);

    // MAP VIEW
    // MKMapView *tempMapView = [[MKMapView alloc] init];
    // [tempMapView setDelegate:self];
    // [self setView:tempMapView];
    // [self setCustomMapView:tempMapView];
    // [tempMapView release];
}

Console output:

2011-02-02 14:10:00.194 Xrails[19501:307] -[MapController loadView]
2011-02-02 14:10:00.209 Xrails[19501:307] -[MapController viewDidLoad]

2011-02-02 14:10:00.212 Xrails[19501:307] -[MapController loadView]
2011-02-02 14:10:00.226 Xrails[19501:307] -[MapController viewDidLoad]

2011-02-02 14:10:00.229 Xrails[19501:307] -[MapController loadView]
2011-02-02 14:10:00.243 Xrails[19501:307] -[MapController viewDidLoad]

2011-02-02 14:10:00.246 Xrails[19501:307] -[MapController loadView]
2011-02-02 14:10:00.259 Xrails[19501:307] -[MapController viewDidLoad]
  • 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-19T17:39:04+00:00Added an answer on May 19, 2026 at 5:39 pm

    I think there’s two points here. Firstly, I think your assumption is right in that whatever is calling for the view is getting nil back and so asks for the view controller’s view again. This causes it to go through -loadView as documented for -view in the documentation for UIViewController.

    As for why -viewDidLoad is being called afterwards, even though it hasn’t loaded the view; I imagine that where -loadView is being called it is assumed that the view has been loaded and calls -viewDidLoad straight afterwards.

    Either way, if you implement -loadView yourself, you must have a valid view at the end of it.

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

Sidebar

Related Questions

Here is something that I have came across in Scala that did not cause
So I'm just learning C#, and came across something that I find odd... I'm
I was just playing around with bit fields and came across something that I
Just came across an issue with my Wordpress template that I can't figure out.
Possible Duplicate: Class with indexer and property named “Item” Just came across something I've
I came across a situation that I had in another project that I'm not
Here's a real life example I had experienced before, and this is something that
Just came across this. It's not affecting anything really but i'm wondering why it's
While reading on Decorator pattern, came across something that needed to be clarified. In
Came across something strange while migrating to my new server. I have a script

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.