0
我可以獲取帶有二維條形碼圖像的字符串消息,並使用輸入字符串生成二維條形碼圖像,但是如何獲取帶有一維條形碼的字符串消息以及如何生成一個字符串?以下代碼是關於二維條形碼:iOS從一維圖像獲取消息字符串
+ (NSString *)decodeImage:(CIImage *)ciImage {
NSDictionary *options = @{CIDetectorAccuracy : CIDetectorAccuracyHigh};
CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:nil options:options];
NSArray *features = [detector featuresInImage:ciImage];
for (CIFeature *feature in features) {
if ([feature isKindOfClass:[CIQRCodeFeature class]]) {
CIQRCodeFeature *qrFeature = (CIQRCodeFeature *)feature;
return qrFeature.messageString;
}
}
return nil;
}
....
一維條形碼如何?