views:

35

answers:

1

Hey guys, I have a little issue here. I need my users to be able to select 4 different points in an image, and then, based on those points, draw a rectangle and crop the image to that rectangle.

Now, I've tried the method in UIImagePickerView that let's you edit the image, but I find it's very limited, and isn't exactly perfect for my needs.

I think I'd be able to handle the cropping to the rectangle part, since there seems to be lots of documentation on the internet about that. But after searching, I still can't find a good way for a user to draw a rectangle (or a shape, for that matter) on a UIImageView.

Any help is appreciated!

Thanks

A: 

I recommend you implement your own view (subclass of UIView) that draws a rectangle based on the user's touches and gestures. Except for the rectangle outline, it should be transparent so it can be used as an overlay of the UIImageView.

Your view class mainly implements/overrides drawRect:. This is where you draw the rectangle.

Codo
OK cool thank you very much. Do you know of any place there's a tutorial or something I could find to help me?
Elton