RollRoll
RollRoll

Reputation: 8472

Taking picture by pressing button, without camera display

Do I have the option of taking picture without having camera display, I just want a button called "Take Picture" and a label that will changed to "taken" when the image the button is pressed and image saved on users album.

everything I find out there is assuming the user wants the camera display

Upvotes: 1

Views: 1937

Answers (1)

lnafziger
lnafziger

Reputation: 25740

Yes, you do have that option but you have to do it the hard way, using the AV Foundation Media Capture methods instead of the much simpler UIImagePickerController. It is a bit complicated, but Apple has some resources to help:

AV Foundation Programming Guide - Media Capture has some information about how you go about this along with sample code snippets (just don't implement the preview portion).

The AVCam sample project shows how to implement all of the methods required to do this. You will need to modify this by removing the preview window and also tweak it if you want to run it on the iPad (they don't properly implement rotation for the iPad in this project).

Those two resources should be a very good starting point for you.

Also, I have not tested the code but this SO answer provides an example of using AV Foundation to capture a photo, and it doesn't provide a preview window.

Upvotes: 1

Related Questions