-1
내 ios 응용 프로그램에서 QR 리더 라이브러리를 사용하고 싶습니다. IOS를위한 최고의 QR 리더 라이브러리는 무엇입니까? github에서 일부를 찾았지만 확실하지는 않습니다.IOS를위한 최고의 QR 리더 라이브러리는 무엇입니까?
내 ios 응용 프로그램에서 QR 리더 라이브러리를 사용하고 싶습니다. IOS를위한 최고의 QR 리더 라이브러리는 무엇입니까? github에서 일부를 찾았지만 확실하지는 않습니다.IOS를위한 최고의 QR 리더 라이브러리는 무엇입니까?
AVFoundation
에서 구현 한
iOS7에에 이것을 시도하고 새로운
캡처 QR 코드 :- (IBAction)Capture:(id)sender {
isFirst=true;
_session = [[AVCaptureSession alloc] init];
_device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
_input = [AVCaptureDeviceInput deviceInputWithDevice:_device error:&error];
if (_input) {
[_session addInput:_input];
} else {
NSLog(@"Error: %@", error);
}
_output = [[AVCaptureMetadataOutput alloc] init];
[_output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
[_session addOutput:_output];
_output.metadataObjectTypes = [_output availableMetadataObjectTypes];
_prevLayer = [AVCaptureVideoPreviewLayer layerWithSession:_session];
_prevLayer.frame = self.view.bounds;
_prevLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[self.view.layer addSublayer:_prevLayer];
[_session startRunning];
}
것은 읽으려면 대리인 메서드를 사용하십시오 :
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection
{
CGRect highlightViewRect = CGRectZero;
AVMetadataMachineReadableCodeObject *barCodeObject;
NSString *detectionString = nil;
NSArray *barCodeTypes = @[AVMetadataObjectTypeUPCECode, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code,
AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode93Code, AVMetadataObjectTypeCode128Code,
AVMetadataObjectTypePDF417Code, AVMetadataObjectTypeQRCode, AVMetadataObjectTypeAztecCode];
for (AVMetadataObject *metadata in metadataObjects) {
for (NSString *type in barCodeTypes) {
if ([metadata.type isEqualToString:type])
{
barCodeObject = (AVMetadataMachineReadableCodeObject *)[_prevLayer transformedMetadataObjectForMetadataObject:(AVMetadataMachineReadableCodeObject *)metadata];
highlightViewRect = barCodeObject.bounds;
detectionString = [(AVMetadataMachineReadableCodeObject *)metadata stringValue];
break;
}
}
if (detectionString != nil)
{
if (isFirst) {
isFirst=false;
_label.text = detectionString;
break;
}
}
else
_label.text = @"(none)";
}
_highlightView.frame = highlightViewRect;
}
체크 아웃 https : //www.appcoda. com/qr-code-reader-swift/ – Amanpreet
zBar가 가장 많이 사용되는 라이브러리입니다. 기능이 제한되어 있으면 원시 카메라로 스캔하여 qr을 스캔합니다. –