简体   繁体   中英

Get size of IBOutlet UIImageView

I need to get the size of an IBOutlet UIImageView drawn in Interface Builder.

But if I read the IBOutlet UIIMageView.image.size.width or .height in the viewDidLoad, viewWillAppear or viewDidAppear method I always get 0 !!!

Where (which method) and how (may be an other variable ?) can I get this information ?

Thank you for your help

does

UIImageView *iv;  
width = iv.frame.size.width;

work any better? Instead of the image, get the size of the UIImageView.

如果未选中文件检查器中的“使用Autolayout”选项,您将获得大小值

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