views:

146

answers:

0

Hello, I am trying to create an image cropping bpx whereby the underlying image can be zoomed an scrolled while the cropping "maskview" layer stays the same and the corners can be dragged in any direction.

To achieve this, the ImageView is added to a UIScrollView, and this is added to the SelectionViewController.view . I then add the cropping "maskview" layer to the SelectionViewController.view. I did this instead of adding to the scrollview so that the cropping maskview won't be expanded when the underlying image expands.

@interface SelectionViewController : UIViewController <UIScrollViewDelegate>
{ 
UIImageView *photoview; // Added to self.scrollview
MaskedView *maskedview; // Added to self.view
UIScrollView *scrollview; // Added to self.view
}

The maskview has first responder status and responds accordingly. However, the only event I am interested in the maskview is if any of the corners are dragged (this works fine). The problem I want to try to solve is two-fold:

  1. If it is a pinch or zoom gesture, I am trying to forward the responder to the UIScrollview using:

    [self.nextResponder touchesMoved:touches withEvent:event];

The scrollview does not seem to respond. I have confirmed that the self.nextResponder after the maskedview is the SelectionViewController's view itself. From there, it doesn't seem like the UIScrollview responds. It does respond fine if I remove the cropping maskedview.

  1. If I zoom in on the underlying image and the cropping maskview rectangle is still the same, I want to now crop the actual zoomed image. Let's say for the upper left hand corner of the crop box, how can I find what the coordinates translates to in the underlying UIImageView now that the image has been zoomed?

Any insight into either of these questions would be appreciated.

Thank you, Winston