iOS 7 - 如何在屏幕截图之上消除白色区域

时间:2014-04-13 21:36:22

标签: ios7 screenshot

使用Xcode 5.1和目标7.1或6.1我正在捕获屏幕截图并将其发布为电子邮件。电子邮件中的图像顶部有一个不需要的白色区域。我使用以下代码:

CGSize mySize;
mySize.width = 320;
mySize.height = 480;
UIGraphicsBeginImageContextWithOptions( mySize, YES, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
NSData *newPNG=UIImagePNGRepresentation(img);
UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:[NSArray arrayWithObjects:newPNG, nil] applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, UIActivityTypeCopyToPasteboard, UIActivityTypePrint];
[self presentViewController:activityVC animated:YES completion:nil];

我想消除获取的屏幕截图顶部的过多空白区域。感谢。

0 个答案:

没有答案