相关疑难解决方法(0)

UITableView在滚动时重复单元格

当我滚动我的UITableView时,出于某种原因,单元格似乎相互绘制.如果我加载我的应用程序,单元格将显示如下:

在此输入图像描述

在滚动此单元格并多次在屏幕上滚动时,它将开始显示如下:

在此输入图像描述

正如你所看到的,我似乎无法解决的问题是错误的.有任何想法吗?

编辑:cellForRowAtIndexPath

static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    NSString *vaultsPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Vaults"];

    NSString *dictionaryPath = [NSString stringWithFormat:@"%@/%@",
                                vaultsPath,
                                [self.vaults objectAtIndex:indexPath.row]];
    NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:dictionaryPath];
    cell = [AHCellCreation createCellWithDictionary:dictionary Cell:cell];

    return cell;
Run Code Online (Sandbox Code Playgroud)

AHCellCreation + createCellWithDictionary:Cell:

//General cell design, same every time
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = CGRectMake(0, 0, 320, 82);
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor colorWithHue:0 saturation:0 brightness:0.91 alpha:1] …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview

3
推荐指数
1
解决办法
3066
查看次数

标签 统计

iphone ×1

objective-c ×1

uitableview ×1