如果我有一个UIImageView,模式设置为中心,例如如何使用代码将其更改为其他模式,例如纵横比适合?
如果我有一个UIImageView,模式设置为中心,例如如何使用代码将其更改为其他模式,例如纵横比适合?
imageView.contentMode = UIViewContentModeScaleAspectFit;
yourImageView.contentMode = UIViewContentModeScaleAspectFit;
你可以将它设置为以下任何一个
UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit,
UIViewContentModeScaleAspectFill,
UIViewContentModeRedraw,
UIViewContentModeCenter,
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight