做二维码扫描的时候需要做一个 开灯 的功能,开启系统灯光的功能,就写了一个demo。
首先需要导入系统拍摄设备的类库,AVFoundation.
代码如下:
- (void)viewDidLoad {
[superviewDidLoad];
UIButton* btn = [[UIButtonalloc] initWithFrame:CGRectMake(50,100, 100,30)];
btn.backgroundColor = [UIColorgreenColor];