标签:inf https ati height ram span code isa scanf
扫描的控件是一个view,使用者只需贴在自己的控制器内即可。其他UI用户可在自己控制器随便添加。代码如下
- (void)viewDidLoad { [super viewDidLoad]; //扫描有效区(即框内透明区域) CGRect interestRect = CGRectMake(20, (self.view.frame.size.height - (self.view.frame.size.width - 40))/2.0f, self.view.frame.size.width - 40, self.view.frame.size.width - 40); //扫描控件 _scanView = [[LFQRCodeScanner alloc] initWithFrame:self.view.bounds rectOfInterest:interestRect]; _scanView.imgLine.image = [UIImage imageNamed:@"line"]; _scanView.scanFilishBlock = ^(AVMetadataMachineReadableCodeObject *result) { NSLog(@"扫描结果:%@",result.stringValue); }; [self.view insertSubview:_scanView atIndex:0];//将扫描view放到底层 } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear: animated]; [self.scanView start]; } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear: animated]; [self.scanView stop]; }
源码地址:https://github.com/zhanglinfeng/LFQRCode
支持cocoaPods
pod ‘LFQRCode‘ (推荐)
iOS 简单易用的二维码扫描及生成二维码三方控件LFQRCode,可灵活自定义UI
标签:inf https ati height ram span code isa scanf
原文地址:http://www.cnblogs.com/zhanglinfeng/p/6871670.html