J'ai un UITableView qui contient 3 NSArrays et 3 NSDictionaries pour chaque tableau.Problèmes UITableView multi-section
- (void)viewDidLoad {
[super viewDidLoad];
contentArray = [[NSMutableArray alloc] init];
self.settingsArray = [NSArray arrayWithObjects:@"Settings", nil];
NSDictionary *settingsDict = [NSDictionary dictionaryWithObject:settingsArray forKey:@"Settings"];
self.infoArray = [NSArray arrayWithObjects: @"Version 1.0", @"© Copyrights 2010", @"Developer Site", @"App Page", @"Report a Bug", nil];
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:infoArray forKey:@"Settings"];
self.contactArray = [NSArray arrayWithObjects: @"Developer Site", @"App Page", @"Report a Bug", nil];
NSDictionary *contactDict = [NSDictionary dictionaryWithObject:contactArray forKey:@"Settings"];
[contentArray addObject:infoDict];
[contentArray addObject:settingsDict];
[contentArray addObject:contactDict];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if ([[infoArray objectAtIndex:indexPath.row] isEqual:@"Version 1.1"]) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
if ([[infoArray objectAtIndex:indexPath.row] isEqual:@"© Copyrights 2010"]) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
if ([[settingsArray objectAtIndex:indexPath.row] isEqual:@"Settings"]) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"NULL" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
if ([[contactArray objectAtIndex:indexPath.row] isEqual:@"Developer Site"]) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
if ([[contactArray objectAtIndex:indexPath.row] isEqual:@"App Page"]) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
if ([[contactArray objectAtIndex:indexPath.row] isEqual:@"Report a Bug"]) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
}
Le problème est quand je suis en train de sélectionner une ligne, l'application se bloque
Merci
Quel message d'erreur est enregistré? – Kurbz
2010-07-25 21: 58: 19.355 Double recherche [48109: 207] *** Terminaison de l'application en raison d'une exception non interceptée 'NSRangeException', raison: '*** - [NSCFArray objectAtIndex:]: index (4) au-delà des limites (1) » 2010-07-25 21: 58: 19,355 double Recherche [48109: 207] Stack: ( 43292752, 44450604 , 43030283, 43030122 , 748457, 187239 , 49603, 3.416.117, 3375658, 330631 , 42571740, 42567848 , 51927197, 51927394 , 3.056.498, 9476,) terminate appelée après avoir lancé une instance de 'NSException' –