I have a UIImage that I want to show pixel for pixel on the iPhone 4 / 4S / 5 screen. It is important that it does not scale at all, but when I try to use setImage , this makes the image too large.
My UIImageView runs in UIStoryboard (since I'm really not familiar with this) and is set to redraw with all the rest of the default value. None of the other modes scale UIImage properly (EDIT: i.e. setting UIImageViews contentMode for other things will not work).
I looked around and found this:
[self.imageView setImage: image]; self.imageView.frame = CGRectMake(self.imageView.frame.origin.x, self.imageView.frame.origin.y, image.size.width, image.size.height);
which does not work. I tried halving each size and it is still off.
UPDATE: I think it scales to display the retina after the fact, because on both the retina of the iPhone 4 that I use and the non-retina simulator mode, the images use the same percentage of the screen. Is there a way I can set up a UIImage or UIImageView or project to “retina ready”?
UPDATE 2: Reducing the size of the image by halving each measurement. The iPhone 4 / 4S has two 2G / 3G / 3GS pixels. But this seems like a hack solution, and I'm not even sure if it uses the pixel density of the retina screen when I do this.
source share