简体   繁体   中英

For some reason when uploading an image to Facebook after taking a picture it rotates image by 90 degrees

The following code is the method that I use to take picture with and then send to Facebook using share kit. Problem is this causes images to be sent with a 90 degree rotation.The reason I know this is the code that is responsible for this is because if I upload an image from the iPhone gallery the image gets shared to Facebook normally.

 - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
    [imagePickerController setSourceType:UIImagePickerControllerSourceTypeCamera];
}
// image picker needs a delegate,
[imagePickerController setDelegate:self];
// Place image picker on the screen
[self presentModalViewController:imagePickerController animated:YES];
 }

The default orientation of a UIImagePickerController is landscape I believe. Therefore, you need to hack around with the image you obtain after taking the picture. There are many ways to do this - check out this link . There are several methods discussed there to normalize the orientation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM