ios - How to allow user to crop a fixed frame of an image iPhone -
i trying find way allow user select part of image he/she wants use. crop size fixed, user can't adjust how big or small want photo.
in mind, screen display photo rectangle on it, user move around his/her touch. press "ok" , image cropped wherever rectangle was.
right code is:
(uiimage *)imagebycropping:(uiimage *)imagetocrop torect:(cgrect)rect { cgimageref imageref = cgimagecreatewithimageinrect([imagetocrop cgimage], rect); uiimage *cropped = [uiimage imagewithcgimage:imageref]; cgimagerelease(imageref); return cropped; }
this code automatically crops image center without giving user chance crop him/herself.
i'm thinking along lines of this:
in above image, user moves picture around in background until part within box want keep, while cropping rest. can zoom in , out on photo pinching.
Comments
Post a Comment