Hi everyone i want build a poem application so i want use to NavigationControlle for show each poem ! i mean i have a TableView and on there + 50 poems ! each cell have differen
Regarding the table cells:
The recommended way of creating table cells is to use UITableView
's
- (UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier
and re-set the cell's subview values to the current row/poem's properties.
Regarding the navigation controller:
You should just have one navigation controller above the table view. When you want to show a poem's details, you just create a PoemDetailsViewController
with an associated XIB, set up the sub-views in IB, connect them, then when a user clicks a table row, in your UITableView's delegate:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
PoemDetailsViewController *poemDetails = [[[PoemDetailsViewController alloc] initWithNibName:@"PoemDetailsViewController" bundle:nil] autorelease];
poemDetails.poem = [poems objectAtIndex:indexPath.row]; // assuming you have a single dimension array with poems and a single table group
[self.navigationController pushViewController:poemDetails animated:YES];
}
The navigation controller will automatically set up your back button and everything, just make sure the PoemDetailsView
has a navigation item.