Akshaykumar Maldhure Akshaykumar Maldhure - 1 month ago 21
Objective-C Question

Image not loading in tableview in iOS 10 on first time, but after scroll?

I am getting problem while displaying images in tableview in iOS 10, but same code works bellow iOS 10, I have added snippet of my code bellow. Please help.

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier = @"InboxTableViewCell";

InboxTableViewCell *cell = (InboxTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
cell = [[InboxTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
[cell setBackgroundColor:[cellColors objectAtIndex:indexPath.row]];
[cell.profileImageView setImage:[UIImage imageNamed:@"profile.jpg"]];

return cell;

And in the cell I am making image circular

#import "InboxTableViewCell.h"
@implementation InboxTableViewCell

- (void)awakeFromNib {
[super awakeFromNib];

// Initialization code


self.profileImageView.layer.cornerRadius = self.profileImageView.frame.size.width/2;
[super layoutSubviews];

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];

// Configure the view for the selected state



Finally I got the answer and I am my own question now. we just have to wright it in drawRect method and thats it.

Happy Coding...

    [super drawRect:rect];
    [_profileImageView setClipsToBounds:YES];
    [_profileImageView layoutIfNeeded];
    [_profileImageView setNeedsDisplay];