裁剪截图为空白 - 斯威夫特

时间:2015-01-16 15:17:37

标签: ios swift screenshot fullscreen crop

我使用此Swift代码裁剪屏幕截图:

UIGraphicsBeginImageContextWithOptions(CGSizeMake(UIScreen.mainScreen().bounds.size.width * 0.25, UIScreen.mainScreen().bounds.size.width * 0.25), false, 0);
    self.view.drawViewHierarchyInRect(CGRectMake(UIScreen.mainScreen().bounds.size.width * 0.5,UIScreen.mainScreen().bounds.size.height * 0.5,view.bounds.size.width,view.bounds.size.height), afterScreenUpdates: true)
    var image:UIImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

然而,屏幕截图全是白色。我的问题是什么?

0 个答案:

没有答案