如何在 Objective-C 中更改 BOOL 的值?lightOn
是BOOL
我需要帮助修改的值。
@synthesize button, view;
-(IBAction)torchOn:(id)sender;
{
AVCaptureDevice*flashlight = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if([flashlight isTorchAvailable] && [flashlight isTorchModeSupported:AVCaptureTorchModeOn] && [lightOn = YES])
{
BOOL success [[flashlight lockForConfiguration:nil]];
if(success)
{
[flashlight setTorchMode:AVCaptureTorchModeOn];
[flashlight unlockForConfiguration];
lightOn = NO;
}
}
}