views:

58

answers:

1

Hi

I have a UIImageView that I dynamically load with an Image using

myTableViewCell.myImageView.image = [UIImage imageNamed:myImageFileName];

myImageView is a UIImageView added to a myTableViewCell.nib and declared as IBOutlet. In IB I set the properties to set the content mode to "ScaleToFill".

The images are larger than the UIImageView and I want to auto-scale them down to the size of the view.

Strangely and whatever I try, this doesn't seem to work (XCode version is 3.2.3).

One Oberservation is that the myTableViewCell.myImageView seems to take it's size from the top cell in the tableview, since the cells below are displayed in equal size to the first cell, even though the image sizes are different.

Note that I use the same myTableViewCell in another tableView with different Icons and there it works. I can't spot the difference between the 2 except the jpg files have different dimensions and aspect ratios ...

  • Is it possible that the TableView-class has something to do with it?
  • Are the image properties that prevent the image from resizing?
A: 

I found th reason for this. In IB the 'Autosizing' parameters were set to strech the image according to the display size.

Changing these parameters to keep the image at constant size resolve the problem.

iFloh