我的 UITableview 单元格的数据源位于:
- (void)connectionDidFinishLoading:(NSURLConnection *)conn {
// We are just checking to make sure we are getting the XML
NSString *xmlCheck = [[[NSString alloc] initWithData:xmlData encoding:NSWindowsCP1252StringEncoding] autorelease];
// NSLog(@"xmlCheck2 = %@", xmlCheck);
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:xmlData];
for (int i=2; i<33; i++) {
NSString *link=[NSString stringWithFormat:@"/html/body/table/tr[%d]/td",i];
NSArray *elements = [xpathParser searchWithXPathQuery:link];
NSString *date = [NSString stringWithFormat:@"%@, %@",[elements[5]text],[elements[1]text]];
[times addObject:date];
[names addObject:[elements[2]text]];
[types addObject:[elements[3]text]];
[places addObject:[elements[4]text]];
NSLog(@"%@", elements);
NSLog(@"%@", [elements[0] text]);
}
}
但是绘制单元格的方法在连接完成之前被调用,即使连接是在我绘制单元格之前启动的。如何延迟绘制单元格方法或确保在绘制单元格之前完成连接?