【发布时间】:2011-03-22 09:59:14
【问题描述】:
我知道这个问题已经被问了一遍又一遍。我已经尝试了所有给定的解决方案,但仍然没有用。我已将数据源和委托设置为我的表格视图,并将其设置为我的指针。
这是我的代码:
- (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的内容吗?
标签: objective-c ios uitableview tableview reloaddata