Added an option for camera flash to be on/off/auto during QR code scanning
This commit is contained in:
@@ -47,12 +47,18 @@
|
||||
|
||||
// Get user parameters
|
||||
NSDictionary *params = (NSDictionary*) [command argumentAtIndex:0];
|
||||
NSString * camera = [params objectForKey:@"camera"];
|
||||
NSString *camera = [params objectForKey:@"camera"];
|
||||
if([camera isEqualToString:@"front"]) {
|
||||
// We do not set any specific device for the default "back" setting,
|
||||
// as not all devices will have a rear-facing camera.
|
||||
self.scanReader.cameraDevice = UIImagePickerControllerCameraDeviceFront;
|
||||
}
|
||||
NSString *flash = [params objectForKey:@"flash"];
|
||||
if([flash isEqualToString:@"on"]) {
|
||||
self.scanReader.cameraFlashMode = UIImagePickerControllerCameraFlashModeOn;
|
||||
} else if([flash isEqualToString:@"off"]) {
|
||||
self.scanReader.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
|
||||
}
|
||||
|
||||
// Hack to hide the bottom bar's Info button... http://stackoverflow.com/a/16353530
|
||||
UIView *infoButton = [[[[[self.scanReader.view.subviews objectAtIndex:1] subviews] objectAtIndex:0] subviews] objectAtIndex:3];
|
||||
|
Reference in New Issue
Block a user