I am new to iPhone programming.
I want to get the height and width of a image, so I can set the frame of UIImageview
accordingly.
Any suggestions how can I get the original size (width and height) of image?
Right-click the image whose size you want to know and select Inspect. View your image's width and height displayed in the Chrome DevTools. (Note, the first number is always the width). If your image is not highlighted by default, click the inspect element button.
Well, if you have the image as UIImage
, then you want to take a look at the size
property:
CGFloat width = myImage.size.width;
CGFloat height = myImage.size.height;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With