0
votes

I have a UIImageView inside of a custom UITableViewCell,

and no matter which image I place in it , it always resizes to fit the image, instead of the other way around.

So if the image is very large, it will occupy the whole cell! I have the UIImageView set to ScaletoFill and I don't understand why this is happening.

Edit: Code was requested.. so this is how I assign the image to the UIImageView, inside a function which builds the UITableViewCell..

UIImageView* ivImage = (UIImageView*)[cell ViewwithTag:0];
ivImage.image = //Some image I have that's loaded from a URL or from local

That's it basically. the UIImageView in the cell was created in IB to a specific size.

Thanks

Roey

1
Actually the tag value is 0? if so then change the value to other then 0 as all the view has tag value to 0 by defaultThe iOSDev
OMG! You were right!! though I had no other tag with the value 0, just changing the value to 4 solved this problem!!Roey Lehman

1 Answers

-1
votes

have you tried setting the contentMode to center???

something like

[cell.imgView setContentMode:UIViewContentModeCenter];