iOS UIImagePickerController result image orientation after upload

后端 未结 20 1943
长发绾君心
长发绾君心 2020-11-22 00:44

I am testing my iPhone application on an iOS 3.1.3 iPhone. I am selecting/capturing an image using a UIImagePickerController:

UIImagePickerCont         


        
20条回答
  •  抹茶落季
    2020-11-22 01:18

    If I understand, what you want to do is disregard the orientation of the UIImage? If so then you could do this:-

    //image is your original image
    image = [UIImage imageWithCGImage:[image CGImage]
                                 scale:[image scale]
                           orientation: UIImageOrientationUp];
    

    or in Swift :-

    image = UIImage(CGImage: image.CGImage!, scale: image.scale, orientation:.Up)
    

    It solved my cropping issue.. Hope, this is what you're looking for..

提交回复
热议问题