SDWebImage图像加载乱序

时间:2014-07-31 23:23:27

标签: ios objective-c

即使应用第一次加载列表,我的图片也不会以正确的顺序加载。

如果我在这里做了一些公然的错误,请告诉我?

- (DetailTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    DetailTableViewCell *cell = (DetailTableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"QueueCell"];

    cell.textLabel.text = _tracks[indexPath.row][@"title"];
    if(_thumbnails.count > indexPath.row)
    {
        [cell.imageView sd_setImageWithURL:[NSURL URLWithString:_thumbnails[indexPath.row]]];
    }
    cell.upVoteButton.tag = indexPath.row;
    cell.downVoteButton.tag = indexPath.row;

    NSString* rating = _tracks[indexPath.row][@"userRating"];
    if(!(rating == (id)[NSNull null] || rating.length == 0))
    {
        if([rating isEqualToString:@"1"])
        {
            cell.upVoteButton.imageView.image = [UIImage imageNamed:@"UpArrowColor"];
            cell.downVoteButton.imageView.image = [UIImage imageNamed:@"DownArrow"];
        }
        else if([rating isEqualToString:@"-1"])
        {
            cell.downVoteButton.imageView.image = [UIImage imageNamed:@"DownArrowColor"];
            cell.upVoteButton.imageView.image = [UIImage imageNamed:@"UpArrow"];
        }
        else
        {
            cell.downVoteButton.imageView.image = [UIImage imageNamed:@"DownArrow"];
            cell.upVoteButton.imageView.image = [UIImage imageNamed:@"UpArrow"];
        }
    }

    return cell;
}

图像随机加载,这次恰好出现在正确的位置。

Screenshot, showing out of order

0 个答案:

没有答案