在下面的代码中,我已经确定一切正常,直到 [tableView reloadData] 我在表视图委托方法中设置了 NSLOG,并且没有一个被调用。我有其他方法可以执行相同的 reloadData 并且效果很好。我唯一不同的是,这是在@catch 块中。也许你们聪明的人可以看到我做错了什么......
@catch (NSException * e) {////chart is user genrated
logoView.image = nil;
NSInteger row = [picker selectedRowInComponent:0];
NSString *selectedAircraft = [aircraft objectAtIndex:row];
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *docsPath = [paths objectAtIndex:0];
NSString *checklistPath = [[NSString alloc]initWithFormat:@"%@/%@.checklist",docsPath,selectedAircraft];
NSString *dataString = [NSString stringWithContentsOfFile:checklistPath encoding: NSUTF8StringEncoding error:NULL];
if ([dataString hasPrefix:@"\n"]) {
dataString = [dataString substringFromIndex:1];
}
NSArray *tempArray = [dataString componentsSeparatedByString:@"\n"];
NSDictionary *temporaryDictionary = [NSDictionary dictionaryWithObject: tempArray forKey:@"User Generated Checklist"];
self.names = temporaryDictionary;
NSArray *tempArray2 = [NSArray arrayWithObject:@"01User Generated Checklist"];
self.keys = tempArray2;
aircraftLabel.text = selectedAircraft;
checklistSelectPanel.hidden = YES;
[tableView reloadData];
}