我试图在iPad中以不同的方向使用MFMailComposer附加截图图像。以纵向方向初始加载,其工作正常,之后根据方向未正确加载。请帮帮我。提前致谢
答案 0 :(得分:1)
我认为在将其附加到MFMailComposer时,您必须遇到UIimage Orientation问题。
要解决此问题,您需要更正UIImge方向。请参阅以下代码以修复屏幕截图的方向
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Picking Image from Camera/ Library
[picker dismissViewControllerAnimated:YES completion:^{}];
self.selectedImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
// Adjusting Image Orientation
NSData *data = UIImagePNGRepresentation(selectedImage);
UIImage *tmp = [UIImage imageWithData:data];
UIImage *fixed = [UIImage imageWithCGImage:tmp.CGImage
scale:selectedImage.scale
orientation:self.selectedImage.imageOrientation];
self.selectedImage = fixed;
}