简体   繁体   中英

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? thanks!

This code should create an imageView with the frame of your image automatically.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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