I am trying to create feed page like Facebook, i am loading images into tableview cells using lazy loading. Sometimes a scroll lock on any random cell occurs but when i try to scroll on any other visible cell above or below, it scrolls. This issue is very sporadic. I am not able to rectify what is causing this behaviour. Please help.
Here is the code;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//label to show values of the menu
static NSString *CellIdentifier = @"CellIdentifier";
// Dequeue or create a cell of the appropriate type.
socialFeedCustomCell *cell = (socialFeedCustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[socialFeedCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ;
cell.accessoryType = UITableViewCellAccessoryNone;
}
for (UIView *tempView in cell.contentView.subviews) {
[tempView removeFromSuperview];
}
[self renderInstagramData:indexPath cell:cell];
cell.contentView.layer.opaque=YES;
cell.layer.shouldRasterize = YES;
cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
cell.selectionStyle=UITableViewCellSelectionStyleNone;
cell.backgroundColor=[UIColor clearColor];
cell.userInteractionEnabled=YES;
return cell;
}
Thanks
It looks like something is blocking your main thread (the thread responsible for the UI updates). Move all the operations not related to UI updates to background queues using GCD. For example: