简体   繁体   English

uiimageview如何显示实际的宽度和高度

[英]uiimageview how to display actual width and height

Hi I am displaying images in UIImageview and some images are small and some are big. 嗨,我在UIImageview中显示图像,有些图像很小,有些图像很大。

how to auto-display the images as per the actual width and height.? 如何根据实际的宽度和高度自动显示图像?

please help 请帮忙

您应该将imageview.frame设置为相应的值(从UIImage.size借用)。

Set the UIImageView frame to be the size of the UIImage 将UIImageView框架设置为UIImage的大小

Something like this 像这样

UIImage *aImage = [UIImage imageNamed:@"yourImage.png"];
yourImageView.bounds = CGRectMake(0, 0, aImage.size.width, aImage.size.height);

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

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