-(IBAction)torchon:(id)sender{
AVCaptureDevice *flashlight = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([flashlight isTorchAvailable] & [flashlight isTorchModeSupported:AVCaptureTorchModeOn]) {
BOOL success = [flashlight lockForConfiguration:Nil];
if(success){
if(yes==YES){
on.hidden = YES;
[UIScreen mainScreen].brightness = 1.0;
[flashlight setTorchMode:AVCaptureTorchModeOn];
[flashlight unlockForConfiguration];
}
}
任何帮助将不胜感激
答案 0 :(得分:1)
我曾经开发过手电筒应用程序(是)我无事可做。你可以看看这里:
https://bitbucket.org/depl0y/illume/src
它闪烁LED并且还执行莫尔斯电码。请务必查看TorchHandler类:https://bitbucket.org/depl0y/illume/src/ad796bc62e44930623970e7d13f401ad767d97d6/Illume/Illume/Classes/TorchHandler.m?at=master
其余的你可以弄清楚自己。