IOS原生API,二维码扫描(https://github.com/reesun1130/SYQRCodeDemo)

2015-07-03 0 1,012
IOS原生API,二维码扫描(https://github.com/reesun1130/SYQRCodeDemo)
+ (BOOL)isAVCaptureActive
{
  AVCaptureDevice *aDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];

  NSError *inputError = nil;
  AVCaptureDeviceInput *aInput = [AVCaptureDeviceInput deviceInputWithDevice:aDevice error:&inputError];

  if (aInput == nil)
  {
      SYLog(@"init AVCapture fail--%@",inputError);

      return NO;
  }

  return YES;
}

if(isAVCaptureActive)
{
   SYQRCodeViewController *syqrc = [[SYQRCodeViewController alloc] init];
   syqrc.SYQRCodeSuncessBlock = ^(NSString *qrString){
     self.saomiaoLabel.text = qrString;
   };

   syqrc.SYQRCodeCancleBlock = ^(SYQRCodeViewController *aqrc){
     self.saomiaoLabel.text = @"扫描取消~";
     [aqrc dismissViewControllerAnimated:YES completion:nil];
   };
   [self presentViewController:syqrc animated:YES completion:nil];
}

遇见资源网 objective-c IOS原生API,二维码扫描(https://github.com/reesun1130/SYQRCodeDemo) http://www.ox520.com/17986.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务