我是编程新手,所以我确定这个问题非常基础(请耐心等待!)
我刚刚将 zxing 安装到我当前的 xcode 4.5 项目中。我花了一段时间来解决错误,但我终于明白了。
我创建了一个名为“扫描”的按钮,我希望在其中调用 zxing。我怎样才能做到这一点?
我已经尝试查看我在源文件中实现的文件,但无法弄清楚要使用哪些类和方法。
是的,我尝试用谷歌搜索这个极其基本的概念,但一无所获:(
最佳答案
这是您需要添加到扫描按钮操作中的代码。
- (IBAction)scanPressed:(id)sender
{
ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:NO];
NSMutableSet *readers = [[NSMutableSet alloc ] init];
<#if ZXQR>
QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init];
[readers addObject:qrcodeReader];
<#endif>
<#if ZXAZ>
AztecReader *aztecReader = [[AztecReader alloc] init];
[readers addObject:aztecReader];
<#endif>
widController.readers = readers;
[self presentModalViewController:widController animated:YES];
}
在您的应用中使用此代码之前删除“<>”符号。
关于iphone - 将 ZXing 连接到 xcode 中的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13944658/