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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:59:34+00:00 2026-06-09T18:59:34+00:00

Basically, I have a TabBarController and some sub-views attached to this controller. The TabBarController

  • 0

Basically, I have a TabBarController and some sub-views attached to this controller. The TabBarController has some properties that I would like to access in the sub-views.

Here’s what I have :

MyTabBarController’s .m

-(void)setDetails:(id)sender
{
    self.myVariable = @"This is a test";
    NSLog(@"Here I set my variable");
}

- (void)viewDidLoad
{
    NSLog(@"[LOAD] My Tab Bar Controller");
    [self setDetails:nil];
}

First subView’s .m

- (void)viewDidLoad
{
    NSLog(@"[LOAD] FirstViewController");

    MyTabBarController *myTBC = (MyTabBarController *)self.tabBarController;
    self.headerName.text = myTBC.myViariable; // Here I just set the UILabel's text
    NSLog(@"Header name = %@", self.headerName);
}

Here’s what I have in the logs :

2012-08-07 11:43:23.001 MyFirstproject[23632:15203] [LOAD] My Tab Bar Controller
2012-08-07 11:43:23.012 MyFirstproject[23632:15203] [LOAD] FirstViewController
2012-08-07 11:43:23.072 MyFirstproject[23751:15203] Header name = (null)
2012-08-07 11:43:23.116 MyFirstproject[23751:15203] Here I set my variable

My question is : As I can see in the logs, the viewDidLoad function of MyTabBarController is called before the FirstViewController’s one. However, it seems the function setDetails of MyTabBarController is called after the function viewDidLoad of the FirstViewController.

How can this be possible ? Is there something I’m doing wrong here ?

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-06-09T18:59:35+00:00Added an answer on June 9, 2026 at 6:59 pm

    Try to put the code for firstViewController in viewDidAppear method instead of viewDidLoad

    Happy Coding 🙂

    And for the difference bet’n those two just check it out the documentation regarding it on Apple’s developer site 🙂

    Formally viewDidLoad call’s once at the time of loading the view

    And viewDidAppearcall’s when ever the view is about to appeared on the screen 🙂

    Happy Coding 🙂

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

Sidebar

Related Questions

I am dealing with some HTML text that I basically have read access to.
I basically have a splitview controller and immediately I would like to show a
basically have two questions. 1. Is there a c++ library that would do full
I basically have a div on my site that always has the same stuff.
I basically have a layout like this: <body> <div style=height: 150px; width: 200px; background:
I basically have a web-browser control that is going through and automatically completing some
I am having some trouble with this. We basically have been asked to create
I basically have a form that you input chat messages into. It looks like
I basically have an application that has, say 5 threads, which each read from
I basically have a setup like this: C:\Upload\A C:\Upload\B C:\Upload\C C:\Upload\D C:\Upload\E Where A

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.