UIImagePickerController continue to select image - iphone

I know UIImagePickerController can only select one image from library each time. When user select one image, UIPickerController will disappear. But I noticed the app "Good Reader", when it launchs UIImagePickerController, after user choose one image, it prompt a small window says "processing the image", but UIImagePickerController does not dissappear which will let the user continue to choose other images.
I do not know how this can be realized?
Welcome any comment.
Thanks interdev

I would think that you just dont call [self dismissModalViewControllerAnimated:YES]; until you are doing processing.
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
// do your magic here, and display processing UI
[self dismissModalViewControllerAnimated:YES];
[picker release];
}

Related

ios custom takePicture button

I want my custom button to take a picture using UIImagePickerController and to save it in my device.
I can save the picture in the device using the default camera controls, although when i turn them off and start using my custom button it doesn't do the job.
- (IBAction)takePhoto:(id)sender {
[picker takePicture];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
self.imageView.image = chosenImage;
UIImageWriteToSavedPhotosAlbum(chosenImage, nil, nil, nil);
[picker dismissViewControllerAnimated:YES completion:nil];
}
didFinishPickingMediaWithInfo is being called but the picture isn't being saved.
How can i achieve this?
I did something similar and used this tutorial to get be started. Have a look.
http://www.musicalgeometry.com/?p=821

how to identify the image take from uiimagePicketController is screenshot or camera image?

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editInfo {
NSLog(#"done");
headingLabel.hidden= NO;
//[self playMovie];
[picker dismissViewControllerAnimated:YES completion:nil];
[self setupCroppingTool:selectedImage];
}
this is the code,so how can i identify the selectedImage is screenshot or camera image
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editInfo
This method picks the image from photo library. You cant compare a screenshot image with a normal image because both are UIImage.
May be help..
I think source property of UIImagePickerController help you.
Example.
UIImagePickerController *abc = [[UIImagePickerController alloc] init];;
abc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
You can use one of this..
UIImagePickerControllerSourceTypePhotoLibrary
UIImagePickerControllerSourceTypeCamera
UIImagePickerControllerSourceTypeSavedPhotosAlbum
Look at the image metadata - date, keywords, geolocation... and compare that.

UIImagePickerController didFinishPickingMediaWithInfo delegate calling is delayed?

I am new to iphone development.I am implementing the UIImagePickerController in my application .When didFinishPickingMediaWithInfo delegate is called that is when choose button is clicked its having some delay .My code is as follows
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
LGViewHUD* hud = [LGViewHUD defaultHUD];
hud.activityIndicatorOn=YES;
hud.bottomText=#"Login..";
[hud showInView:picker.view];
[self performSelectorInBackground:#selector(pickerFunction:) withObject:info];
}
- (void) pickerFunction :(NSDictionary *)info
{
profilePicture.image = [info objectForKey:#"UIImagePickerControllerEditedImage"];
[imgPicker dismissModalViewControllerAnimated:YES];
}
I am trying to bring a hud on choose button action but it comes only after some delay.Can any one suggest me a methods for this implementation.
Thanks in advance..
I don't think there is anything to do about it.
I've had the problem myself, and it seems that the lag is coming from UIImagePickerController calling the delegate method "didFinishPickingMediaWithInfo". Once it gets to that method, everything runs quickly. It doesn't matter what code you put into "didFinishPickingMediaWithInfo". The lag time happens BEFORE that method is even called.
I even tried this, which does nothing except dismiss the controller.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissModalViewControllerAnimated:YES];
}
and it still took a few seconds do dismiss the UIImagePickerController.
I had a similar delay occurring with this delegate. Turns out the didFinishPickingMediaWithInfo isn't called until the image/video is compressed, which can take a few seconds depending on what it is.

UIImagePicker always issues imagePickerControllerDidCancel in iOS 5

So I'm retesting one of my apps that I know works with iOS 4.2 and up on the new iOS 5, and for some reason, they don't want to play nice. My UIImagePicker delegate will, upon the user selecting a photo from the photo library, ALWAYS issue an imagePickerControllerDidCancel, and never allow the picture to be selected (just says the image is nil when I try to load it). This is the code I know works on previous versions of iOS, so I have no idea why it wouldn't work now, unless Apple has changed how UIImagePicker works.
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage : (UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
mainPhoto.image = image;
[self saveImage:image];
[picker dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *) picker
{
[picker dismissModalViewControllerAnimated:YES];
}
And here is the code that calls the UIImagePicker:
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated:YES];
[picker release];
Any ideas? Or has anyone else had this problem?
Documentation for
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage : (UIImage *)image editingInfo:(NSDictionary *)editingInfo says,
"Deprecated in iOS 3.0. Use imagePickerController:didFinishPickingMediaWithInfo: instead.".Try to follow the suggestion and let us know if you still face issue ?

Capturing image using custom buttons in cameraoverlayview in iphone

Thanks in advance.
I have created a custom toolbar on cameraOverlayView. One of the toolbar buttons will trigger the takeSnap method –
-(IBAction)takeSnap
{
NSLog(#"take snap called");
[self.picker takePicture];
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editingInfo
{
UIImage *image = img;
NSLog(#"image : %#",image);
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
NSLog(#"Did cancel called");
}
But it is not calling the delegate methods after capturing. The view continues to remain in capture mode. If any one know the reason please help me.
Its very likely that you haven't assigned a delegate properly.