UIIMagePickerController don't automatically dismiss picker - iphone

How do you prevent the UIImagePickerController from automatically dismissing the camera after a picture is taken?

You set the picker to allowsImageEditing to be YES before you present it.
picker.allowsImageEditing = YES;
picker.delegate = self;
[self presentModalViewController:picker animated:YES];

Related

Customising iphone cameraview(overlay)

My iPhone app allows the user to record videos.
How can I customize my camera view like in the screen shots.(also I need to make a custom timer-countDown)
You need to put all the custom elements in a UIView and assign that view to the cameraOverlayView property.
- (void)takePicture {
if (([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera] == NO)) return;
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
// add a custom view overlay
[imagePickerController setCameraOverlayView:customView];
[self presentModalViewController:imagePickerController animated:YES];
[imagePickerController release];
}
See also http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html#//apple_ref/occ/instm/UIImagePickerController/cameraOverlayView

ARToolkit, UIImagePickerController & cameraOverlayView: How to take a picture?

I am developing an Augmented Reality app for iPhone with ARToolkit. Now I want to include its functionality in a main app, with a button which throws an 'AR View', in order to be able to take a picture with the 3D model on it.
I am using UIImagePickerController with cameraOverlayView to add the ARViewController view to the camera view, as an overlay, but it does not show it. Here it is the code:
-(IBAction)Switch2AR:(id)sender{
ARController = [[ARViewController alloc] init];
[ARController loadView];
UIImagePickerController *picker = [[UIImagePickerController alloc]init];
picker.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
else {
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
picker.showsCameraControls = YES;
picker.cameraOverlayView = ARController.view;
//[ARController.view addSubview: picker.view];
//[picker.view addSubview: ARController.view];
//[picker viewWillAppear:YES];
//[picker viewDidAppear:YES];
//[ARController viewWillAppear:YES];
//[ARController viewDidAppear:YES];
[self presentModalViewController:picker animated:YES];
[ARController release];
}
I also tried to add the UIImagePickerController view as a subview of the ARViewController view, but does not work since the camera modal view 'hides' the AR view. Also ARViewController view as UIImagePickerController subview.
The problem is that I cannot overlay my ARView and the camera view in any way I tried
Thanks in advance
Just change
picker.showsCameraControls = YES;
to
picker.showsCameraControls = NO;
and it should work.

iphone how to go to the image gallery after taking photo through Xcode

Hi all I am implementing the following code to take a photo through my application
[[[UIApplication sharedApplication] keyWindow] setRootViewController:picker];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:NO];
Can anyone tel me How I can go to the photo gallery after the user takes the photo and not return to the application.
i think you might want to try this
How to open camera while I click the UIButton in iPhone?
or i really didn't get the question
Edit:
Well you can use the same code with UIImagePickerControllerSourcePhotoLibrary after taking the pic from camera. I mean call this Function with UIImagePickerControllerSourcePhotoLibrary then it will take you to photo Library and then back again to your application.
UIImagePickerControllerSourcePhotoLibrary
If you want to shoot a picure use this code -
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
picker.allowsImageEditing = YES;
[[self navigationController] presentModalViewController:picker animated:YES];
If you want to go to photo gallery and wants to select a photo from there use this code -
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
picker.allowsImageEditing = YES;
[[self navigationController] presentModalViewController:picker animated:YES];
Notice the difference between the picker's sourceType

dismiss ModalViewController from another viewcontroller in iPhone

The new 3.1 sdk allows for the UIImagepickerController to hide the camera controls and use your own controls via cameraOverlay view. So, I implemented the overlay view through another Viewcontroller:
CameraViewController *cameraController = [[CameraViewController alloc] initWithNibName:#"CameraViewController" bundle:nil];
self.cameraviewController = cameraController;
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.cameraOverlayView = cameraviewController.view;
picker.showsCameraControls = NO;
[self presentModalViewController:picker animated:YES];
[cameraController release];
[picker release];
The cameraviewController.view has the Cancel button. The problem I'm facing is how to dismiss the Modal view with that cancel button. I haven't found a way of referencing the controller which called the Modalview.
Many thanks in advance
need to add cameraController.delegate = self; and setup the delegate protocol in CameraViewController.

Camera Preview inside Window with iPhone

I can launch a camera capture with UIImagePicker but capture process is done in another view. Is it possible to 'embed' camera preview into the application window?
What I use is:
UIImagePickerController *picker;
picker = [[UIImagePickerController alloc]init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.allowsImageEditing = YES;
picker.delegate = self;
[self presentModalViewController:picker animated:YES];
The closest you can come is to add a cameraOverlayView to the camera view and put a 'frame' around the picture. However, this will crop, rather than scale, the viewfinder.
You can add the preview as a subview like this:
[self.view addSubview:picker.view];
[picker viewWillAppear:YES];
[picker viewDidAppear:YES];