简体   繁体   English

使用UIImageView显示正确的图像大小

[英]using UIImageView to show correct image size

how do you use UiimageView to show an image to make sure the imageview is the correct size of the UIImage? 你如何使用UiimageView显示图像,以确保imageview是正确的UIImage大小? thanks! 谢谢!

This code should create an imageView with the frame of your image automatically. 此代码应自动创建带有图像框架的imageView。

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ImageName"]];

A little background from the docs . 来自文档的一点背景知识。

This method adjusts the frame of the receiver to match the size of the specified image. 此方法调整接收器的帧以匹配指定图像的大小。 It also disables user interactions for the image view by default. 默认情况下,它还会禁用图像视图的用户交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM