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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:28:54+00:00 2026-05-27T06:28:54+00:00

I have a UITableView which loads through it’s navigationController a new viewcontroller. This code

  • 0

I have a UITableView which loads through it’s navigationController a new viewcontroller.
This code goes in the tableView:didSelectRowAtIndexPath method:

ConcertDetailViewController *detailVC = [[ConcertDetailViewController alloc] initWithNibName:@"ConcertDetailViewController" bundle:nil];

The UITableView has a model, I want to sent an element of this model to the newly created ViewController.

detailVC.aProd = [_prod objectAtIndex:indexPath.row];

When the value is set I want the detailVC to draw the data on the screen. I thought a custom setter, overwriting the one generated by @synthesize would work.

-(void)setaProd:(NSMutableDictionary *)aProd {
_aProd = aProd;
[self displayAProd];
}

displayAProd just takes the values in aProd and put’s them on the screen, or rather I’m setting some value of an outlet , created in my nib file.

self.prodNameLbl.text = [_aProd objectForKey:@"name"];

Nothing special about this. But it just doesn’t work. I figured out why, I think.
It’s because the setter executes way faster then, loading the whole view into memory.
If I put self.prodNameLbl.text = @”something”; in the viewDidLoad method it does display the correct value in the label.
A quick workaround would be the see if _concerts has been set and from there call displayAProd. Here I’m doubting myself if it’s a good way to load a view. What if the custom setter takes longer to execute the loading the view. The test to see if _concerts has been set will be false and nothing will be displayed. Or is that just impossible to happen ?

Or maybe there’s a better pattern for loading views and passing data to them to be displayed.

Thanks in advanced, Jonas.

  • 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-27T06:28:55+00:00Added an answer on May 27, 2026 at 6:28 am

    The problem is that when you load the view controller from the NIB, the IBOutlets will not be connected to your UILabel and other similar properties during the initWithNibName call.

    You need to wait for viewDidLoad to be called on detailVC and call [self displayAProd] from there. At this point, the connections will have been made.

    Do a quick test. Put a break point in your didSelectRowAtIndexPath method and, after initialising detailVC, check to see if prodNameLbl is null or not.

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

Sidebar

Related Questions

I have a UITableView which loads data from XML using the below code. It
I have a UITableView which loads its data from the web. It takes a
I have a UITableView (on a UIViewController) which is pushed via a navigationController. Along
I have a UITableView which is populated by an array, I have a button
I have a UITableView which displays about 5 cells at a time, yet in
I have a grouped UITableView which displays a number of cells, which includes both
I have an array of objects which populate a UITableView . When a user
I have set up a UITableView-based app, which has a .plist for holding the
i have a uitableview which will load a uiwebview with a long page (static
I have a UITableView in my app in which I load several images from

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.