AVCaptureDevice.h, mainly used to get the iphone some properties about camera devices.
AVCaptureDevice.h, the Avfoundation.framework package must be introduced.
1. Front-and rear-facing cameras
enum { 1, 2};typedef nsinteger avcapturedeviceposition;
2. Flash switch
enum { 0, 1, 2};typedef Nsinteger Avcaptureflashmode;
3. Flashlight Switch
enum { 0, 1, 2};typedef Nsinteger Avcapturetorchmode;
4. Focal length adjustment
enum { 0, 1, 2};typedef Nsinteger Avcapturefocusmode;
5. Adjustment of exposure volume
enum { 0, 1, 2};typedef Nsinteger Avcaptureexposuremode;
6. White balance
enum { 0, 1, 2
Turn on the Flash
avcapturedevice* d = nil;//Find a device by position
nsarray* alldevices = [Avcapturedevice devices];
For (avcapturedevice* Currentdevice in alldevices)
{
if (currentdevice.position = = Avcapturedevicepositionback)
{
D = currentdevice;
}
}
//at this point, D may still is nil, assuming we found something we like ....
nserror* err = nil;
BOOL lockacquired = [D lockforconfiguration:&err];
if (!lockacquired) {
//log err and handle ...
} else {
//Flip on the flash mode
if ([D hasflash] && [D Isflashmodesupported:avcaptureflashmodeon])
{
[D Setflashmode:avcaptureflashmodeon];
}
[D unlockforconfiguration];
}
Several properties of Avcapturedevice