I want to load images from UIImagePickerController, then save the selected photo to my app\'s document directory.
UIImage *image = [info objectForKey:UIImage
Please try this one.
func rotateImage(image: UIImage) -> UIImage? {
if (image.imageOrientation == UIImage.Orientation.up ) {
return image
}
UIGraphicsBeginImageContext(image.size)
image.draw(in: CGRect(origin: CGPoint.zero, size: image.size))
let copy = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return copy
}
Happy Codding :)