views:

336

answers:

1

Hi, I am new to iphone development. I want to display the actual size of the image in image view. I have created image view by using Interface builder and set the properties. Now the problem is, I have set into "Scale to Fill", then the image will be stretched in the full screen. Now i want to display the actual size of the image will be displayed in image view. For example 52X52 size image should be displayed with the same size in the image view.The 1200X1020 size image should be fit to the size of the image view .So according the size of the image it should fit to image view and i want the image smaller than image view should retain its original size(It should not stretch to fit the image view). Is it any possible solution to achieve it, please guide me.

Thanks.

+2  A: 

You're going to have to check the dimensions on the UIImage yourself and then set the proper property on the UIImageView: myImage.contentMode = UIViewContentModeCenter , etc

The different content modes: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/c/econst/UIViewContentModeScaleToFill

Eric Schweichler