-1

我正在尝试修复一个错误,该错误表明滑块未声明变量我需要一些快速帮助

h.文件

@interface LightViewController : UIViewController {
IBOutlet UISlider *slider;
IBOutlet UISlider *theslider;
IBOutlet UISlider *customslider;
UIButton *onButton;
UIButton *offButton;
UIImageView *onView;
UIImageView *offView;
}

@property(nonatomic, strong) IBOutlet UIButton *onButton;
@property(nonatomic, strong) IBOutlet UIButton *offButton;
@property(nonatomic, strong) IBOutlet UIImageView *onView;
@property(nonatomic, strong) IBOutlet UIImageView *offView;
@property(nonatomic, readonly) float torchLevel;

-(BOOL)setTorchModeOnWithLevel:(float)torchLevel error:(NSError **)outError;
-(BOOL)supportsAVCaptureSessionPreset:(NSString *)preset;
-(IBAction)torchOn:(id)sender;
-(IBAction)torchOff:(id)sender;
@end

m.文件

- (void)sliderDidChange:(UISlider *)slider
{
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
[device lockForConfiguration:nil];
[device setTorchModeOnWithLevel:slider.value error:NULL];
[device unlockForConfiguration];
}
4

0 回答 0