【发布时间】:2009-04-06 19:21:51
【问题描述】:
我有以下方法应该用数组中的数据填充我的 UITableView 的单元格。我想使用正在加载数据的行作为索引从数组中获取数据。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
cellComments=(FullCommentCell *)[tableView dequeueReusableCellWithIdentifier:FullCommentCell_ID];
if(cellComments==nil)
{
[[NSBundle mainBundle]loadNibNamed:@"FullCommentCell" owner:self options:nil];
NSLog([NSString stringWithFormat:@"%i",indexPath.row]);
[cellComments loadFullComments:[latestFMLComments objectAtIndex:indexPath.row]];
}
//cellComments.userInteractionEnabled=NO;
return cellComments;
}
这没有按预期工作。该表最终只填充了我的数组的前三个元素,然后这些数据被重复使用,直到我的表结束。该表应该使用我数组中的所有数据。知道为什么这没有按预期工作吗?
【问题讨论】:
标签: iphone objective-c cocoa cocoa-touch