我能够按照QR阅读器教程,但它只能扫描代码并在标签上输出链接或文本或图像名称。我希望能够扫描代码并将其发送到我的iOS应用程序上的不同视图控制器。理想情况下,QR码是帐号,并且在扫描QR码之后,该特定帐户的视图控制器将打开。其他QR码将有其他帐号,并将在同一样式视图控制器上打开另一个帐户。
-(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection{
if (metadataObjects != nil && [metadataObjects count] > 0) {
AVMetadataMachineReadableCodeObject *metadataObj = [metadataObjects objectAtIndex:0];
if ([[metadataObj type] isEqualToString:AVMetadataObjectTypeQRCode]) {
[_lblStatus performSelectorOnMainThread:@selector(setText:) withObject:[metadataObj stringValue] waitUntilDone:NO];
[self performSelectorOnMainThread:@selector(stopReading) withObject:nil waitUntilDone:NO];
[_bbitemStart performSelectorOnMainThread:@selector(setTitle:) withObject:@"Start!" waitUntilDone:NO];
_isReading = NO;
这是我的代码。我试图使QR码只是简单的文字,如" A123"当标签= @" A123"并在标签= @" A123"但它不起作用。