Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageView Flickering on a cell when reloadData #1587

Closed
3 tasks done
CavalcanteLeo opened this issue Jun 6, 2016 · 5 comments
Closed
3 tasks done

ImageView Flickering on a cell when reloadData #1587

CavalcanteLeo opened this issue Jun 6, 2016 · 5 comments
Labels
Milestone

Comments

@CavalcanteLeo
Copy link

CavalcanteLeo commented Jun 6, 2016

New Issue Checklist

Issue Info

Info Value
Platform Name ios
Platform Version 9.0
SDWebImage Version 3.7.6
Integration Method cocoapods
Xcode Version Version 7.3.1 (7D1014)

Issue Description and Steps

My imageView of a tableViewCell is flickering all the time I reload the tableview.
It only occurs using SDWebImage

on my tableViewCellForRow:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

        AddUser_TableViewCell *cell;
        if (!cell) {
            cell = [tableView dequeueReusableCellWithIdentifier:@"UserAddCell" forIndexPath:indexPath];
        }
        User *user = searchModel.listOfUsers[indexPath.row];
        cell.delegate = self;
        cell.labelUsername.text    = user.username;
        cell.buttonAdd.selected    = user.following;
        cell.indexPath = indexPath;
        if(user.name){
            cell.name.hidden = NO;
            cell.name.text = user.name;
        }else{
            cell.name.hidden = YES;
        }

        [cell updateButtonUI];

        if(user.profilePictureURL){
            [cell.imageViewUser sd_setImageWithURL:user.profilePictureURL
                                  placeholderImage:nil
                                           options:SDWebImageProgressiveDownload];
        }else{
            cell.imageViewUser.image  = [UIImage imageNamed:@"avatar"];
        }

        return cell;

}

and the method to request the data from serve:

#pragma mark Search For Users
-(void)searchForUsers{
    if (searchModel.nextPageUsers == 0) {
        [self stopAnimationUsers];
        return;
    }
    if (self.searchBar.text.length <= 1 ) {
        timeHiRequestState = TimeHiRequestStateInactive;
        [searchModel.listOfUsers removeAllObjects];
        searchModel.listOfUsers = [NSMutableArray new];
        [self stopAnimationUsers];
        [self.tableViewUsers reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
        NSLog(@"*** reload data ***");
        return;
    }

    timeHiRequestState = TimeHiRequestStateLoading;
    [self.tableViewUsers reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];

    [searchModel requestSearchPeopleWithName:self.searchBar.text success:^(AFHTTPRequestOperation *operation, id response, bool success){

        timeHiRequestState = TimeHiRequestStateSuccess;
        [self stopAnimationUsers];
        [self.tableViewUsers reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];


    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        timeHiRequestState = TimeHiRequestStateError;
        [self stopAnimationUsers];
        [self.tableViewUsers reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];
    }];
}

I have tried with both [reloadData] and [reloadSections withRowAnimation] and both are blinking the imageView

Here is the video of the issue:
http://quick.as/r1w9tbYwR

@bpoplauschi bpoplauschi added this to the 4.0.0 milestone Jun 6, 2016
@bpoplauschi bpoplauschi added the bug label Jun 6, 2016
@KanybekMomukeyev
Copy link

same here

@CavalcanteLeo
Copy link
Author

CavalcanteLeo commented Jul 13, 2016

it occurs on setShouldCacheImagesInMemory, just commented this line and it worked

[[SDImageCache sharedImageCache] setShouldCacheImagesInMemory:NO];

But if i don't use setShouldCacheImagesInMemory, SDWebImage will be really expensive, see #1544

@bpoplauschi bpoplauschi modified the milestones: Future, 4.0.0 Oct 1, 2016
@neilabdev
Copy link

neilabdev commented Jun 20, 2017

+1 (Retraction: I thought this was the issue, but was something else. 4.0 is working in this regard for me)

@sauchye
Copy link

sauchye commented Oct 22, 2018

@CavalcanteLeo Hi, the same issues, but now version not method
[[SDImageCache sharedImageCache] setShouldCacheImagesInMemory:NO];
Version 4.3.3 when i reload cell imageView Flickering, if you know please tell me, thank u :)

@sauchye
Copy link

sauchye commented Oct 22, 2018

@bpoplauschi @CavalcanteLeo Hi , same issues, but Version 4.3.3 not this method
[[SDImageCache sharedImageCache] setShouldCacheImagesInMemory:NO];
if you know, please tell me ,thank u :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants