0

I'm trying to download an image from an url and display into a cell (sample below):

NSURL *url = [NSURL URLWithString:@"http://images.google.com/intl/en_ALL/images/logos/images_logo_lg.gif"];

NSData *data = [NSData dataWithContentsOfURL:url];

[cell.imageView setImage:[UIImage imageWithData:data]];

Somehow when I display into the cell, it covers the whole cell, bigger than my UIImageView.

But If I display the image locally like below:

[cell.imageView setImage:[UIImage imageNamed:@"defaultProfile.png"]];

It fits perfectly into the UIImageView I set into the cell.

Why is this the case?

user1372829
  • 1,121
  • 1
  • 11
  • 21

1 Answers1

0

use scaleToFit property of imageview

Sumit Mundra
  • 3,891
  • 16
  • 29