Search code examples
ios5user-interfaceuiimageviewcontrols

Interface for cropping operation: user-resizeable rectangle drawn on image


I am trying to figure out a way to crop a UIImage as it's done in Photoshop Express:

enter image description here

So basically you just touch and drag the corners to resize the rectangle, then you tap the check button and it crops the image. Now I have the crop part done -- I made a method that crops an image from a CGRect but I am having problems with this resizable rect. Everything I have tried has not worked, and it's making me crazy, because I know it is probably just something easy. Has anyone ever done anything like this or know of an example on the web?


Solution

  • Here you have the source code for the custom control you are looking.

    http://www.cocoacontrols.com/platforms/ios/controls/bjimagecropper

    I recommend you to browse that webpage http://www.cocoacontrols.com, you will find tons of sample code, and most of it has an open license so you can use it in your own app.

    Hope that helps!