J'ai essayé de pousser une nouvelle vue quand une cellule est tapée mais absolument rien ne se passe. Je pensais que le style groupé poussait de la même manière que la plaine. Voici mon code:Comment pouvez-vous pousser une nouvelle vue avec une table groupée?
-(void)viewDidLoad {
[super viewDidLoad];
contactArray = [[NSArray alloc] initWithObjects:@"iPhone",@"iPod",@"MacBook",@"MacBook Pro",nil];
shareArray = [[NSArray alloc] initWithObjects:@"Flex",@"AIR",@"PhotoShop",@"Flash",nil];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
// Customize the number of rows in the table view.
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if(section == 0)
return [contactArray count];
else
return [shareArray count];
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
if(section == 0){
return @"Contact";
}else{
return @"Share";
}
}
-(NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
if(section == 0){
return @"Footer for Apple Products";
}else{
return @"Footer for Adobe Softwares";
}
}
// 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] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
if(indexPath.section == 0){
cell.text = [contactArray objectAtIndex:indexPath.row];
}else{
cell.text = [shareArray objectAtIndex:indexPath.row];
}
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"NextView" bundle:nil];
//[self.navigationController pushViewController:nextController animated:YES];
if([contactArray objectAtIndex:indexPath.row] == @"iPhone"){
LandscapeHydrogen *abo = [[LandscapeHydrogen alloc] initWithNibName:@"LandscapeHydrogen" bundle:nil];
[self.navigationController pushViewController:abo animated:NO];
[abo release];
}
}
Toute aide est appréciée.
toujours rien, dit piège Debugger mach msg – Tanner
Où avez-vous mis le point d'arrêt? Définissez-le à l'instruction if et passez la souris sur chaque ligne pour voir comment le code s'exécute. – Rengers
Je l'ai mis à droite sur l'instruction if dans la méthode didselectrowatindexpath. Rien n'a été affiché dans le débogueur mais la flèche rouge a traversé toute la méthode comme elle le ferait normalement. Si vous connaissez un autre moyen de transformer une vue groupée en une table groupée, cela fonctionnera. J'en ai juste besoin pour pousser quelques vues différentes en fonction de ce qui est sélectionné. – Tanner