How do I autoresize an image, but at the top of the ImageView (programmatically in Xcode)?
问题 I have an imageView (say 100x100) that I want to fill with a (smaller) image (say 50x10) and I want the image to go at the top of the view , not at the middle of the view. If I use imageView.contentMode = UIViewContentModeScaleAspectFit; it fills the view with the image scaled at 100x20 (as expected) but in the middle of the view. Like this: +---------+ | | |i m a g e| <---my image (scaled) | | +---------+ <---my UIImageView If I set imageView.contentMode = UIViewContentModeTop |