ios - Add a circular cropping component for UIImagePicker? -


i have circular framed uiimageview , need add circular framed cropping tool uiimagepickercontroller, after image selected photo library. similar instagram's uiimagepicker's crop component. how add type of component?

update

i've found repo circular cropping tool https://github.com/ruslanskorb/rskimagecropper

but can guide me on how implement cropping tool uiimagepickercontroller after user selects photo photo library?

update

i getting following message in debugger :

enter image description here

and buttons in crop view disabled, meaning cannot select them.. message debugger relaying on me?

here code:

  @ibaction func chooseprofilepicture(sender: anyobject) {          var mypickercontroller = uiimagepickercontroller()         mypickercontroller = uiimagepickercontroller()         mypickercontroller.delegate = self;         mypickercontroller.sourcetype = uiimagepickercontrollersourcetype.photolibrary          self.presentviewcontroller(mypickercontroller, animated: true, completion: nil)     }      func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) {          var image : uiimage = (info[uiimagepickercontrolleroriginalimage] as? uiimage)!          editprofilepictureimageview.image = image          self.dismissviewcontrolleranimated(false, completion: { () -> void in              var imagecropvc : rskimagecropviewcontroller!              imagecropvc = rskimagecropviewcontroller(image: image, cropmode: rskimagecropmode.circle)              imagecropvc.delegate = self              self.navigationcontroller?.pushviewcontroller(imagecropvc, animated: true)          })      } 

example demo

yes can add rskimagecropper in uiimagepickercontroller

define imagepicker

var imagepicker : uiimagepickercontroller! 

in viewdidload

    imagepicker = uiimagepickercontroller()     imagepicker.delegate = self     imagepicker.sourcetype = uiimagepickercontrollersourcetype.photolibrary;     self.presentviewcontroller(imagepicker, animated: true, completion: nil) 

delegate methode :

func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) {      var image : uiimage = (info[uiimagepickercontrolleroriginalimage] as? uiimage)!      picker.dismissviewcontrolleranimated(false, completion: { () -> void in          var imagecropvc : rskimagecropviewcontroller!          imagecropvc = rskimagecropviewcontroller(image: image, cropmode: rskimagecropmode.circle)          imagecropvc.delegate =self          self.navigationcontroller?.pushviewcontroller(imagecropvc, animated: true)      })  } 

see :

enter image description here


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -