각 배열에 대해 3 개의 NSArrays와 3 개의 NSDictionaries를 포함하는 UITableView가 있습니다.다중 섹션 UITableView 문제
- (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];
}
}
문제는 내가 당신이 범위를 넘는 인덱스를 액세스 할 때 그 오류가 발생합니다
어떤 오류 메시지가 기록됩니까? – Kurbz
2010-07-25 21 : 58 : 19.355 이중 검색 [48109 : 207] *** 캐치되지 않은 예외 'NSRangeException'으로 인해 응용 프로그램 종료 중, 이유 : '*** - [NSCFArray objectAtIndex :] : 인덱스 (4) 넘어 (1) ' 2010-07-25 21 : 58 : 19.355 듀얼 검색 [48,109 : 207] 스택 ( 43,292,752, 44,450,604, 43,030,283, 43,030,122, 748,457, 187,239 , 49,603, 3,416,117 , 3,375,658, 330,631 , 42,571,740, 42,567,848, 51,927,197, 51,927,394, 3,056,498, 9476,,536,9330 ) 'NSException'의 인스턴스를 던진 후 호출 terminate –