-1

我尝试截屏一半屏幕并将其保存到照片库。我使用下面的代码工作得很好,但它捕获了我所有的屏幕。我只需要它一半的屏幕。我正在使用 xcode 4.4。我知道有很多关于这个的问题帖子。但我无法让它工作出现错误。请帮助

IGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(newImage, nil, nil, nil);
4

1 回答 1

0

在你的行UIGraphicsBeginImageContext(self.view.bounds.size.width,self.view.bou‌​nds.size.height/2.0);

替换此行

希望对你有帮助。。

于 2013-01-17T14:37:26.100 回答