([metadataObjects count ] >
0 ) { [ _session stopRunning ]; [_scanImageView removeFromSuperview];
AVMetadataMachineReadableCodeObject * metadataObject = [metadataObjects objectAtIndex :
0 ]; stringValue = http://www.netofthings.cn/ErWeiMa/2017-04/metadataObject. stringValue ;"hljs-comment" style="box-sizing: border-box; color: #93a1a1;">// 当前延迟1.0秒 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(
1.0 *
NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [SVProgressHUD dismiss];
self.scanResult.text = stringValue; });}
这里,附带一下方法的代用和开始扫描方法的调用
-(void)viewDidLoad { [super viewDidLoad]; [self setupScanQRCode];}-(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self startAnimate]; [_session startRunning];}-(void)dealloc{ if (_preview) { [_preview removeFromSuperlayer]; } if (self.maskLayer) { self.maskLayer.delegate = nil; }}
五、以上就是所有的代码了,那么看一下运行的结果吧,这里我只扫描了2二维码和条形码。
ps:截gif的时候,出了点差错,勿怪啊。
8/9 首页 上一页 6 7 8 9 下一页 尾页