在下面的代碼中,我確定一切正常,直到[tableView reloadData]我已經在表視圖委託方法中設置NSLOGs,並沒有被調用。我有其他方法做相同的reloadData,它完美的作品。我失去的唯一區別是這是在@catch塊。也許你聰明的傢伙可以看到的東西,我做錯了......iphone重載表查看
@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];
}
這可能不會幫助,但只是出於好奇,你嘗試過使用'self.tableView',而不是'tableView'? – shosti 2010-05-18 02:33:41