有人可以指出我正确的方向。我一直在寻找这个,但似乎无法找到明确的答案。我有一个 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;
}
这工作正常。我可以拉入图像并捏合和缩放。但是现在我如何获得缩放和坐标以在完成后将照片切片?