Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hi there #3

Open
denigada opened this issue Mar 15, 2015 · 7 comments
Open

hi there #3

denigada opened this issue Mar 15, 2015 · 7 comments

Comments

@denigada
Copy link

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

@jacobsieradzki
Copy link
Owner

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 notifications@github.com 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 #3.

@denigada
Copy link
Author

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
Copy link
Author

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

@jacobsieradzki
Copy link
Owner

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 notifications@github.com 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 #3 (comment).

@denigada
Copy link
Author

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

@jacobsieradzki
Copy link
Owner

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 notifications@github.com 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.

@pahnev
Copy link

pahnev commented Apr 23, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants