UIImage aspect fit and align to top(UIImage 方面适合并对齐到顶部)
问题描述
It looks like aspect fit
aligns the image to the bottom of the frame by default. Is there a way to override the alignment while keeping aspect fit
intact?
** EDIT **
This question predates auto layout. In fact, auto layout was being revealed in WWDC 2012 the same week this question was asked
In short, you cannot do this with a UIImageView
.
One solution is to subclass a UIView
containing an UIImageView
and change its frame according to image size. For example, you can find one version here.
这篇关于UIImage 方面适合并对齐到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!