Is it possible for a user to draw a dotted line (in a circle) around the bit of the UIImageView they wish to crop to, and then for the UIImageView to resize to those points? It’s a bit like the lasso/marquee effect in Photoshop:

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Update: Since iOS 8.x, UIImageView provides a
maskViewproperty. Just prepare an image with some opaque pixels, create another image view with that mask image, and set this mask image view as the maskView. The opaque pixels in the mask image will be the ones shown in the underlying image..
Original Answer
There’s quite a bit to do, but here’s a high-level outline:
Create image: A simple idea here is to just ship a black image with your project. It should be sized to match the maximum region a user can select. Read the image into memory (
UIImage imageNamed:) and set it up as the drawing context by callingUIGraphicsBeginImageContext.Create path: (see apple docs). When the user starts stroking the region, call
CGContextBeginPath, then follow user gestures, sampling the touches and adding small segments by callingCGContextMoveToPointrepeatedly as touchesMoved.Create mask: To turn the path into a mask you want a black background and the path filled with white. If you started with a black image, you just need to do the fill. See the same apple guide about doing that.
Finally, you’ll apply this mask to your imageView’s image. Here’s a decent reference for that.