Sunnyheart
通过以下代码可以调用闪光灯的打开和关闭状态。
//打开
-(void)turnOnLed {   
 AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];        
 if ([device hasTorch]) {       
  [device lockForConfiguration:nil];       
  [device setTorchMode: AVCaptureTorchModeOn];       
  [device unlockForConfiguration];          
 }   
} 
//关闭
-(void)turnOffLed {   
 AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];     
 if ([device hasTorch]) {       
  [device lockForConfiguration:nil];       
  [device setTorchMode: AVCaptureTorchModeOff];       
  [device unlockForConfiguration];     
 }   

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
  • 2021-08-26
  • 2021-05-31
猜你喜欢
  • 2021-11-09
  • 2022-02-07
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
相关资源
相似解决方案