开发者

Get size of IBOutlet UIImageView

开发者 https://www.devze.com 2022-12-18 07:47 出处:网络
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 view开发者_Go百科

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 view开发者_Go百科DidAppear 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.


You will get the size value, if "Use Autolayout" option in file inspector is unchecked

0

精彩评论

暂无评论...
验证码 换一张
取 消