Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Fix image orientation on iPad
Browse files Browse the repository at this point in the history
  • Loading branch information
张国晔 committed Mar 1, 2014
1 parent 4a61108 commit 8adad0e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion Tweak.x
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,30 @@
MFMailComposeViewController *mc = [MFMailComposeViewController new];
if (mc) {
UIImage *_UICreateScreenUIImage();
NSData *screenshot = UIImagePNGRepresentation(_UICreateScreenUIImage());
UIImage *image = _UICreateScreenUIImage();
UIInterfaceOrientation orientation = self.interfaceOrientation;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && orientation != UIInterfaceOrientationLandscapeLeft) {
CGSize size = image.size;
UIImageOrientation rotate;
CGFloat height, width;
if (orientation == UIInterfaceOrientationLandscapeRight) {
rotate = UIImageOrientationDown;
height = size.height;
width = size.width;
} else {
height = size.width;
width = size.height;
if (orientation == UIInterfaceOrientationPortrait)
rotate = UIImageOrientationLeft;
else
rotate = UIImageOrientationRight;
}
UIGraphicsBeginImageContext(CGSizeMake(height, width));
[[UIImage imageWithCGImage:[image CGImage] scale:1.0 orientation:rotate] drawInRect:CGRectMake(0 ,0 ,height ,width)];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
NSData *screenshot = UIImagePNGRepresentation(image);
mc.mailComposeDelegate = self;
[mc setSubject:@"Spam Report"];
id<CKMessage> message = [self messageForBalloonView:view];
Expand Down

0 comments on commit 8adad0e

Please sign in to comment.