답변:
let heightInPoints = image.size.height
let heightInPixels = heightInPoints * image.scale
let widthInPoints = image.size.width
let widthInPixels = widthInPoints * image.scale
위의 답변 중 일부는 기기를 회전 할 때 제대로 작동하지 않습니다.
시험:
CGRect imageContent = self.myUIImage.bounds;
CGFloat imageWidth = imageContent.size.width;
CGFloat imageHeight = imageContent.size.height;
let imageView: UIImageView = //this is your existing imageView
let imageViewHeight: CGFloat = imageView.frame.height
let imageViewWidth: CGFloat = imageView.frame.width