0

如果我有一个 77x77 的图像视图并且我想在这个图像视图中调整一个 UIImage,这可能吗?在我想在这个imageview中设置一个大小为300x200的图像的例子中,有没有办法在这个imageview(77x77)中调整这个图像?谢谢

4

1 回答 1

3

是的,myImageView.contentMode = UIViewContentModeScaleAspectFit;

该属性继承自UIView

UIViewContentMode

指定视图在大小更改时如何调整其内容。

typedef enum {
   UIViewContentModeScaleToFill,
   UIViewContentModeScaleAspectFit,
   UIViewContentModeScaleAspectFill,
   UIViewContentModeRedraw,
   UIViewContentModeCenter,
   UIViewContentModeTop,
   UIViewContentModeBottom,
   UIViewContentModeLeft,
   UIViewContentModeRight,
   UIViewContentModeTopLeft,
   UIViewContentModeTopRight,
   UIViewContentModeBottomLeft,
   UIViewContentModeBottomRight,
} UIViewContentMode;
于 2012-07-03T19:25:27.570 回答