为什么我不能将视图正确保存为图像?

时间:2011-05-13 14:40:56

标签: objective-c ios4 screenshot

所以我在很大程度上成功地做到了这一点。但由于某种原因,获取屏幕截图的图像无法正确截屏。

例如此图片:

http://postimage.org/image/kfioellw/

想要像这样裁剪:

http://postimage.org/image/kfkbxy3o/

它最终是这样的:

http://postimage.org/image/kflzhalg/

我正是这样做的:

-(IBAction)cropButtonPressed {
    UIGraphicsBeginImageContext(thumbnailScroll.frame.size);
    [thumbnailScroll.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *pThumbnail = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    [delegate didFinishCroppingImage:(UIImage *)pThumbnail withSmallPicture:(UIImage *)pThumbnail andOriginalPicture:(UIImage *)pThumbnail];
}

-(void)didFinishCroppingImage:(UIImage *)croppedImage withSmallPicture:(UIImage *)smallPic andOriginalPicture:(UIImage *)original {
    normalThumbnail.image = croppedImage;
    UIImageWriteToSavedPhotosAlbum(normalThumbnail.image, nil, nil, nil);
    [self dismissModalViewControllerAnimated:YES];
}

我不明白为什么它没有截断我在UIScrollView中的内容。有帮助吗?我会尝试根据需要提供尽可能多的细节。

0 个答案:

没有答案