UIImageView - > UIScrollview,裁剪和剪辑滚动查看cooridantes

时间:2012-04-04 23:31:50

标签: ios objective-c uiscrollview uiimageview crop

有人能指出我正确的方向吗?我一直在寻找这个,但似乎无法找到一个明确的答案。我有一个300x300像素的UIScrollview。在里面,我有一个UIImageView。这个想法是允许用户从他们的库中抓取一张照片,然后在300x300的滚动视图中捏合并缩放它。然后将视口保存为新照片。

到目前为止,我有这个......

    -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {

    UIImageView *insideImgView = [[UIImageView alloc] initWithImage:image];
    scroller.contentSize = CGSizeMake(image.size.width, image.size.height);
    scroller.maximumZoomScale = 4.0;
    scroller.minimumZoomScale = 0.0;
    scroller.clipsToBounds = YES;
    scroller.delegate = self;
    [self setSendImage:insideImgView];
    [scroller addSubview:insideImgView];
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
    return sendImage;
}

这很好用。我可以拉入图像并捏合和缩放。但是现在如何在完成照片后获得缩放和坐标来切片?

1 个答案:

答案 0 :(得分:1)

将视图的内容导出到图像中非常简单。

在这篇文章中尝试使用St3fan的答案:Get a PDF/PNG as output from a UIWebView or UIView