QRCode在iOS中编码一个简单的字符串 [英] QRCode encoding a simple string in ios
问题描述
我已从 github 下载了示例代码
它可以正常工作,并为我指定的字符串生成带有QRCode的图像。
It works fine and generates an image with QRCode for string that I specified.
但是,当我扫描该图像时,它显示类似 http:// mystring
的字符串。
But, when I scan that image, it displays the string like http://mystring
.
我只需要 mystring
。怎么做?问题是QRscanner应用程序存在吗?
I need only mystring
. How to do that? Is the problem is with QRscanner app?
我认为 QRencoderapp 是关于对url进行编码。
I think the QRencoderapp is about encoding an url.
是否有其他示例可以对一个简单的字符串进行编码(不是
Is there any other sample to encode just a simple string (not url)?
或
是否需要做任何更改来获取字符串而不是上面的url代码?
Is there any changes to be done get the string instead of url in the above code?
推荐答案
我已经解决了我的问题。
I 've solved my problem.
I从 Github链接下载了一个项目。
I downloaded a project from this Github link.
该代码中的代码为简单文本创建QRCode图像。
The code in that prjct creates a QRCode image for a simple text.
NSString *code = @"Our String to be encoded";
Barcode *barcode = [[Barcode alloc] init];
self.view.backgroundColor = [UIColor whiteColor];
[barcode setupQRCode:code];
ourImageView.image = barcode.qRBarcode;
希望,这对其他人有帮助。
Hope, this will help others.
这篇关于QRCode在iOS中编码一个简单的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!