possible deception of this question: How to scale UIImageView proportionally?
I will also copy the text of the accepted answer. Suppose your frame is a uiview:
imageView.contentMode = UIViewContentModeScaleAspectFit; will do what you want.
from documents, here are other scaling options
UIViewContentMode Specifies how a view adjusts its content when its size changes. typedef enum { UIViewContentModeScaleToFill, UIViewContentModeScaleAspectFit, UIViewContentModeScaleAspectFill, UIViewContentModeRedraw, UIViewContentModeCenter, UIViewContentModeTop, UIViewContentModeBottom, UIViewContentModeLeft, UIViewContentModeRight, UIViewContentModeTopLeft, UIViewContentModeTopRight, UIViewContentModeBottomLeft, UIViewContentModeBottomRight, } UIViewContentMode;
apple Documentation here: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImageView_Class/Reference/Reference.html
source share