Comment faire que les cellules individuelles vont à différents View Controller. À l'heure actuelle, en utilisant la méthode im en utilisant, si je clique sur la première cellule, il m'amène à un contrôleur de vue où j'ai une photo. maintenant si je reviens et clique sur la deuxième cellule, il me prend au même contrôleur de vue. Comment est-ce que je change ceci de sorte que toutes les autres cellules individuelles vont au contrôleur individuel de vue? qu'est-ce que j'ajoute ou que dois-je configurer?comment ajouter des données individuelles à des cellules individuelles?
ici mon code:
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
NSUInteger row = [indexPath row];
cell.textLabel.text = [breakdownArray objectAtIndex:row];
bookDetailViewController.title = [NSString stringWithFormat:@"%@" , [breakdownArray objectAtIndex:row]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
*/
NSInteger row = [indexPath row];
if (self.bookDetailViewController == nil); {
BookDetailViewController *aBookDetail = [[BookDetailViewController alloc] initWithNibName:@"BookDetailView" bundle:nil];
self.bookDetailViewController = aBookDetail;
[aBookDetail release];
}
bookDetailViewController.title = [NSString stringWithFormat:@"%@" , [breakdownArray objectAtIndex:row]];
Books2010AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.breakdownNavController pushViewController:bookDetailViewController animated:YES];
}