JSImagePickerController icon indicating copy to clipboard operation
JSImagePickerController copied to clipboard

hi there

Open denigada opened this issue 9 years ago • 7 comments

hi, i am a beginner ios developer and i am willing to use your code in my test app. I am trying to add photos to imageviews but i also want to crop the image after selection with a circle crop just like this :http://i.stack.imgur.com/cdFdE.png

can you please help me to that. I want this screen to come after choosing the image

denigada avatar Mar 15 '15 16:03 denigada

I might add this as a feature to the control at some point if I get the time but if you wish to do it yourself then look at the allowsEditing property of the UIImagePickerController class and edit in the JSImagePickerController source code.

Have a look here: https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIImagePickerController_Class/index.html#//apple_ref/occ/instp/UIImagePickerController/allowsEditing https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIImagePickerController_Class/index.html#//apple_ref/occ/instp/UIImagePickerController/allowsEditing

On 15 Mar 2015, at 16:15, denigada [email protected] wrote:

hi, i am a beginner ios developer and i am willing to use your code in my test app. I am trying to add photos to imageviews but i also want to crop the image after selection with a circle crop just like this :http://i.stack.imgur.com/cdFdE.png http://i.stack.imgur.com/cdFdE.png can you please help me to that. I want this screen to come after choosing the image

— Reply to this email directly or view it on GitHub https://github.com/jacobsieradzki/JSImagePickerController/issues/3.

jacobsieradzki avatar Mar 15 '15 16:03 jacobsieradzki

I dont have the enough development knowledge to make this happen :( If you have time to add this feature, i would really appreciate your help. By the way sorry if my english is bad

denigada avatar Mar 15 '15 16:03 denigada

and i try to make 2 image pickers. i try this:

  • (void)addPhoto1:(id)sender { JSImagePickerViewController *imagePicker = [[JSImagePickerViewController alloc] init]; imagePicker.delegate = self;

    [imagePicker showImagePickerInController:self animated:YES]; }

  • (IBAction)addPhoto2:(id)sender { JSImagePickerViewController *imagePicker2 = [[JSImagePickerViewController alloc] init]; imagePicker2.delegate = self;

    [imagePicker2 showImagePickerInController:self animated:YES]; }

But how can i identify the picker in - (void)imagePickerDidSelectImage:(UIImage *)image { method ??

Like do this if picker2 used or to that if picker 1 was used

denigada avatar Mar 16 '15 22:03 denigada

You could always try and add a tag property to the JSImagePickerController as an int, and also include the JSImagePickerController object in the imagePickerDidSelectImage method. Like I said I don’t have time at the moment but thanks for the idea for an update.

But you could try what I said so it would work like this:

  • (void)addPhoto1:(id)sender { JSImagePickerController *imagePicker = [[JSImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.tag = 1;

    [imagePicker showImagePickerInController:self animated:YES]; }

  • (void)addPhoto2:(id)sender { JSImagePickerController *imagePicker = [[JSImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.tag = 2;

    [imagePicker showImagePickerInController:self animated:YES]; }

  • (void)imagePicker:(JSImagePickerController *)imagePicker didSelectImage:(UIImage *)image { if (imagePicker.tag == 1) { // This delegate was sent from [self addPhoto1:(id)sender]; } else { // This delegate was sent from [self addPhoto2:(id)sender]; } }

Cheers,

Jake Sieradzki

On 16 Mar 2015, at 22:42, denigada [email protected] wrote:

and i try to make 2 image pickers. i try this:

(void)addPhoto1:(id)sender { JSImagePickerViewController *imagePicker = [[JSImagePickerViewController alloc] init]; imagePicker.delegate = self;

[imagePicker showImagePickerInController:self animated:YES]; }

(IBAction)addPhoto2:(id)sender { JSImagePickerViewController *imagePicker2 = [[JSImagePickerViewController alloc] init]; imagePicker2.delegate = self;

[imagePicker2 showImagePickerInController:self animated:YES]; }

But how can i identify the picker in - (void)imagePickerDidSelectImage:(UIImage *)image { method ??

Like do this if picker2 used or to that if picker 1 was used

— Reply to this email directly or view it on GitHub https://github.com/jacobsieradzki/JSImagePickerController/issues/3#issuecomment-81970764.

jacobsieradzki avatar Mar 16 '15 22:03 jacobsieradzki

i get this error at the line of imagePicker.tag =1 : Property 'tag' not found on object of type 'JSImagePıckerViewController'

I really appreciate your help

EDIT: i managed to do it. really thank you. my only problem now is cropping the image after selection

denigada avatar Mar 16 '15 22:03 denigada

Yes, the tag is only inherited from the UIView class which UIImagePickerController does not inherit from, so you have to manually put it in by adding a property to JSImagePickerController.h

Sent from my iPhone

On 16 Mar 2015, at 10:56 pm, denigada [email protected] wrote:

i get this error at the line of imagePicker.tag =1 : Property 'tag' not found on object of type 'JSImagePıckerViewController'

I really appreciate your help

— Reply to this email directly or view it on GitHub.

jacobsieradzki avatar Mar 16 '15 23:03 jacobsieradzki

Just made a PR. I'm not too familiar with with delegates, but I think this is better solution.

pahnev avatar Apr 23 '15 01:04 pahnev