0

I have a program that takes an image and crops out everything except for a thin rectangle. The dimensions of the new image are something like 500x150. How do I get a UIImageView to display the entire image without scaling it?

func putOnImageView(image:UIImage) {
    let cgImage = CGImageCreateWithImageInRect(oldImage.CGImage,CGRect(0,0,500,150)

    let image = UIImage(CGImage: cgImage!, scale:0, orientation: oldImage.imageOrientation)

    imageView.frame = CGRect(0,0,50,50)

    imageView.image = image
}
mawnch
  • 385
  • 2
  • 4
  • 13

0 Answers0