Reputation: 628
i'm trying to retrieve the width and height of an image view on different size of iPhone with the following code
print(self.imageLength.bounds.size.height)
print(self.imageLength.bounds.size.width)
yup, it return the same value 128.0 on iPhone 5, iPhone 6, iPhone 6 plus. but the UIImage shows on interface does changed according to different phone size. Does anyone why?
Here is the image constraints
Upvotes: 1
Views: 826
Reputation: 848
you can try this
let imgWidth = myImageView.layer.frame.width
let imgHeight = myImageView.layer.frame.height
print(imgWidth)
print(imgHeight)
Upvotes: 3