-2

我在 UITableViewCell 中创建了 UIScrollview。scrollView 有一些图片要水平显示。它在一行中运行良好,但我正在加载多个行单元格,当一个单元格被其他单元格替换时会出现问题。

我正在使用[tableView dequeueReusableCellWithIdentifier:section].

我还为每一行提供了单独的标识符。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath 
{
    NSString *section = [NSString stringWithFormat:@"section%@cell", indexPath.section];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:section]; 
    if (cell == nil) 
    { 
        cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:section]; 
        NSArray *pageImages = imgs; 
    }    
    else
    {
        NSLog(@"recall");
    } 
    return cell;
}
4

1 回答 1

0

您不想给每个单元格一个不同的重用标识符。改变

NSString *section = [NSString stringWithFormat:@"section%@cell", indexPath.section];

NSString *section = @"Arbitrary";
于 2012-08-09T13:52:27.063 回答