0

I have a UIViewController that implements a UIScrollView with the UIScrollViewDelegate. Attached to it is an UIImageView for which the user must crop the photo via zooming it and panning to fill the entire length of the screen. After the user has finished cropping and they hit done, the original UIImage gets sent to the next UIViewController.

I'm wondering, is there anyway, using the original image, to display it in a UIScrollView and allow the user to zoom and pan it so ONLY the cropped area gets shown? IE none of the image that was outside of the cropped area gets shown in zooming and panning? Is there a way to do this without explicitly cropping the image?

Ser Pounce
  • 14,196
  • 18
  • 84
  • 169

2 Answers2

1

This might head you in the right direction: Displaying part of an image

Not to sure if this will work with the way you are displaying it. But if it does it could be a simple solution. You can also read through UIScrollviews and maybe use panGestureRecognizer and pinchGestureRecognizer to limit the area they can zoom and pan.

Community
  • 1
  • 1
Jaybit
  • 1,864
  • 1
  • 13
  • 20
  • I attached the imageview to a uiview and set the clipsToBounds property on the UIView to yes (and obviously adjusted the imageViews frame to move it around). – Ser Pounce May 15 '12 at 08:13
0

Set the content size of the UIScrollView to the rect of the cropped area.