ios - Dimming the LED for iPhone 5 flashlight app in xCode -


I want to dim the torch LED with a slider option; I know Apple supports it for iOS 6 Yes, though, I'm not really sure which code to use. Here is the code that is currently in .m file. - (IBAction) torchon: (ID) sender; {OnButton.hidden = Yes; OffButton.hidden = NO; OnView.hidden = NO; OffView.hidden = Yes; AVCaptureDevice * flashlight = [AVCaptureDevice default DeviceWithMediaType: AVMediaTypeVideo]; If ([Flash LightTrue is Available] & amp; [Flash LightSchmod Support is Supported: AVCaptureTorchModeOn]) {BOOL Success = [Flash Lot LockFor Configuration: Zero]; If (success) {[Flash Light Settorchmod: A Weekptuartchmod On]; [Flash UnlockFor configuration]; }}} - (IBAction) torchOff: (ID) sender; {OnButton.hidden = NO; OffButton.hidden = Yes; OnView.hidden = Yes; OffView.hidden = No; AVCaptureDevice * flashlight = [AVCaptureDevice default DeviceWithMediaType: AVMediaTypeVideo]; If ([Flash LightTrue is Available] & amp; [Flash LightSchmod Support is Supported: AVCaptureTorchModeOn]) {BOOL Success = [Flash Lot LockFor Configuration: Zero]; If (success) {[Flash Light Set Torchod: A Weakapturcododf]; [Flash UnlockFor configuration]; }}}

Any suggestions?

- (BOOL) setTorchModeOnWithLevel: (float) torchLevel error: (NSError **) outError

What you want, however, which I can see is only updated in some interval (~ 0.2).

  AVCaptureDevice * device = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeVideo]; [Device Lockforcing: Zero]; [Device SetchordModeOn Level Level: Slider. Value Error: Zero]; [Device UnlockFor configuration];   

Edit - Full example:

Here is a UISlider You must add an IBAction outlet to your slider or programmatically targeting (like I did I will add):

  UISlider * slider = [[UISlider alloc] initWithFrame: CGRectMake (20.0f, 20.0f, 280.0F, 40.0F)]; Slider. MaximumValue = 1.0f; Slider.minimumValue = 0.0f; [Slider setconness: yes]; [Slider addTarget: Self-action: @Selector (Slidered Change) Control events: UI ControlEventWalls]; [Self.view addSubview: slider];   

Then, in response to changing the slider:

  - (zero) sliderDidChange: (UISlider *) slider {AVCaptureDevice * device = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeVideo ]; [Device Lockforcing: Zero]; [Device SetchordModeOn Level Level: Slider. Value Error: Zero]; [Device UnlockFor configuration]; }    

Comments

Popular posts from this blog

python - Assemble mpeg file unable to play in mediaplayer -

c# - crystal report failed -

mongodb - CakePHP paginator ignoring order, but only for certain values -