Show program shutter programmatically?

To do my custom UIImagePickerSourceTypeCamera, I had to do this:

pickerOne = [[UIImagePickerController alloc] init];
pickerOne.delegate = self;
pickerOne.sourceType = UIImagePickerControllerSourceTypeCamera;
pickerOne.showsCameraControls = NO;
pickerOne.navigationBarHidden = YES;
pickerOne.toolbarHidden = YES;
pickerOne.wantsFullScreenLayout = YES;

But now, when I take a picture as follows:

[cameraButton addTarget:pickerOne 
                 action:@selector(takePicture)
       forControlEvents:UIControlEventTouchUpInside];

It does not show the shutter when you take a picture. Is there a way to show this programmatically?

+3
source share
2 answers

It is possible. The trick is to do the following:

Turn on the camera controls when initializing the collector (this will display the shutter).

pickerOne.showsCameraControls = YES;

Superimpose the camera controls on your look, which has cameraButton

In your method, takePicture:do the following:

pickerOne.showsCameraControls = NO;
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.0]];
[pickerOne takePicture];

In the method, imagePickerController:didFinishPickingMediaWithInfo:do the following:

pickerOne.showsCameraControls = YES;  // perform on main thread
+2
source

"". .

+1

All Articles