我知道这个问题一再被问过。我试过所有给定的解决方案,但仍然无法正常工作。我已经设置了数据源和委托到我的表视图,并将其设置为我的指针。ReloadData不会触发cellForRowAtIndexPath
这里是我的代码:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"%i", resultSoap.count);
return resultSoap.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
NSString *cellValue = [resultSoap objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
NSLog(@"Celldisplay");
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
我已经在我的viewDidLoad:
方法称为reloadData
。事情是,它发射了numberOfRowsInSection:
方法,我得到的行数是正确的,但它并没有触发这个cellForRowAtIndexPath:
方法。
任何解决方案?
它返回多少行?在调试模式下,你能看到resultSoap的内容吗? – Peres 2011-07-07 10:15:14