Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are a few things to do here. First, in </p> <p>MyTableViewController.m</p> <pre><code>NSMutableArray *tempArray = [[[NSMutableArray alloc] initWithObjects:@"Item 1",@"Item 2",@"Item 3",@"Item 4",@"Item 5",@"Item 6", nil] autorelease]; // Use the setter of your instance variable here. self.tableDataList = tempArray; // Release your temp array (when you don't use ARC) [tempArray release]; </code></pre> <p>In </p> <p>TableViewDetailsView.h you should provide a public instance variable so you can set the details you want to display. Right now it is a string you want to display. Later it could be a custom model with data. One way to do it is to declare the @property. For example in TableViewDetailsView.h:</p> <pre><code>@property (nonatomic, retain) NSString *myDetailString; </code></pre> <p>So you initalize your DetailViewController and set the data you want to display right when the user taps the row. So in your "- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath" in MyTableViewController.m you do:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { TableViewDetailsView *temp = [[TableViewDetailsView alloc] initWithNibName:@"TableViewDetailsView"bundle:nil]; // No autorelease here! // Use the declared instace variable of the detailViewController temp.myDetailString = [self.tableDataList objectAtIndex:indexPath.row]; [self.navCont pushViewController:temp animated:YES]; // Clean up [temp release]; } </code></pre> <p>If you declare your myDetailString as an IBOutlet, you can link it with your .xib file and set it up in Interface Builder. Otherwise you would have to set it up in code, For example in your viewDidLoad method. The string to display is already set inside the other method (didSelectRowAtIndexPath)… Hope that clears some things. Otherwise ask again.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload