版权声明:本文为博主原创文章,未经博主允许不得转载。
先导入AVFoundation.framework框架
#import <AVFoundation/AVFoundation.h>
-(void) turnOnAndturnOff:(bool)isBool
{
AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([captureDevice hasTorch]) {
[captureDevice lockForConfiguration:nil];
[captureDevice setTorchMode: AVCaptureTorchModeOn];//开灯
// [device setTorchMode: AVCaptureTorchModeOff];//关灯
[captureDevice unlockForConfiguration];
}
}
转载请注明出处:http://blog.csdn.net/sevenquan