相关疑难解决方法(0)

在UITableView中滚动后混合的项目

当我滚动我的UITableView时,细胞变得混乱.我究竟做错了什么?

这是我的方法:

- (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];
    }
    [cell insertSubview:[itemArray objectAtIndex:indexPath.row] atIndex:indexPath.row]; 
    return cell;
}
Run Code Online (Sandbox Code Playgroud)

更新

它现在通过使用cell.contentView工作,但现在当我选择一个项目时,所选项目将覆盖不同单元格的内容...

iphone cocoa-touch

0
推荐指数
1
解决办法
2537
查看次数

标签 统计

cocoa-touch ×1

iphone ×1