Reputation: 259
(First post here ... new to iOS.)
In my xTableViewController in the the didSelectRowAtIndexPath method I am setting the value of data to be displayed in a detail view for the row:
[xDetailViewController setDetailLabel:[xDetailTextArray objectAtIndex:row]];
In my xDetailViewController.xib I have an sub view for detailLabel and the IBOutlet is declared as an ivar and property in xDetailViewController.h and synthesized in xDetailViewController.m. My confusion here is how to get the value for detailLabel, created in the xTableViewController, to display in the detail view label sub view. I know that the detailLabel is hooked up correctly in the XIB because in the xDetailViewController viewWillAppear method I can have the detailLabel display a value when the table row is selected by using:
detailLabel.text = @"test detail text";
... but I am lost as to how to get detailLabel.text to display the value of the row from xDetailTextArray created in the xTableViewController. By stepping through the debugger I see that detailLabel contains the correct data value from the array for the row I selected.
I guess I conceptually don't get that if I have set the value for detailLabel.text as in the first snippet and I can see the data value for it in the debugger, why doesn't the data value "just appear" in the outlet when the detail view is pushed for display? And since it is not, what do I code, I assume, in the xDetailViewController to display the data?
Upvotes: 0
Views: 498
Reputation: 3390
Any warnings? try
self.xDetailViewController.detailLabel.text = [xDetailTextArray objectAtIndex:row];
maybe you can't call the setFunction
Upvotes: 1