I'm trying to allow the users of my application to take more then one picture without having to press the "take picture" button on my application again. So instead of
"take picture" -> capture -> use -> "take picture" -> capture
it would be,
"take picture" -> capture -> use -> capture -> use -> capture -> use
Here's the code I have right now,
The method [self btnLoadImage]; at the end is calling the same method that happens whe "take picture" button is pressed. However, the camera does not come back up. I also tried to reload the camera from within the method - (void) imagePickerController: and the application crashed once I tried it. Thanks for any help you can provide.
"take picture" -> capture -> use -> "take picture" -> capture
it would be,
"take picture" -> capture -> use -> capture -> use -> capture -> use
Here's the code I have right now,
Code:
- (void) imagePickerController: (UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *image;
NSURL *mediaUrl;
mediaUrl = (NSURL *)[info valueForKey:UIImagePickerControllerMediaURL];
if(mediaUrl == nil){
image = (UIImage *) [info valueForKey:UIImagePickerControllerEditedImage];
if(image == nil){
image = (UIImage *) [info valueForKey:UIImagePickerControllerOriginalImage];
//[image retain];
AnnotatedImage *a = [[AnnotatedImage alloc] initWithName:@"Picture" description:@"mmmm"];
NSData *reducedImage = UIImageJPEGRepresentation(image, .5);
[reducedImage retain];
// [a setImage: image];
[a setImage2: reducedImage];
// NSData *pngImage = UIImagePNGRepresentation(image);
UIImage *myThumbNail = [[UIImage alloc] initWithData:reducedImage];
// begin an image context that will essentially "hold" our new image
UIGraphicsBeginImageContext(CGSizeMake(150.0,150.0));
// now redraw our image in a smaller rectangle.
[myThumbNail drawInRect:CGRectMake(0.0, 0.0, 150.0, 150.0)];
//[myThumbNail release];
// make a "copy" of the image from the current context
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[a setThumbImage:newImage];
[myThumbNail release];
[images addObject:a];
[a release];
}
else{
imageView.image = image;
}
}
else {
//<#statements#>
}
[picker dismissModalViewControllerAnimated:YES];
[self btnLoadImage];
}
The method [self btnLoadImage]; at the end is calling the same method that happens whe "take picture" button is pressed. However, the camera does not come back up. I also tried to reload the camera from within the method - (void) imagePickerController: and the application crashed once I tried it. Thanks for any help you can provide.