我想要获取一个数字字符串并生成一个简单的条形码,它可以被任何扫描仪读取。
我已经可以使用相机和读取条形码,但现在我想生成一个条形码。
有没有人知道可以让我做这件事的sdk,资源或者代码片段?
谢谢
发布于 2011-04-23 03:44:19
唯一做到这一点的免费库是Cocoa-Touch-Barcodes,它是cocoabarcodes的一个分支。如果你正在考虑商业化的库,有一个叫做iPhone Barcode Generator。
更新检查此ZXing的objective-c端口:https://github.com/TheLevelUp/ZXingObjC
发布于 2011-05-29 18:18:00
将:#import "NKDBarcodeFramework.h"包含在你的头文件中,并把下面这几行放在你的初始化函数中。
barcode = [NKDExtendedCode39Barcode alloc];
barcode = [barcode initWithContent:@"1234567890123" printsCaption:0];
[barcode calculateWidth];
NSLog(@"%@",[barcode description]);
theImage = [UIImage imageFromBarcode:barcode];
subview = [[UIImageView alloc]initWithFrame:TTScreenBounds()];
[subview setImage:theImage];
[self addSubview:subview];
self.frame = self.bounds;玩得开心:-)
发布于 2013-11-13 03:59:16
条形码的类型太多了
每种条形码类型都有许多子类型,并且每种类型都有自己的用途。
我解释了如何生成一个D条形码类型代码39
这里我将解释如何使用自定义字体生成条形码
步骤:
1)从here下载自定义字体
2)从下载的压缩包中附加FRE3OF9X.ttf文件
3)将应用程序提供的关键字体添加到info.plist中,并在项目0中将FRE3OF9X.ttf作为值
4)尝试下面的代码片段
UIFont *fntCode39=[UIFont fontWithName:@"Free3of9Extended" size:30.0];
UILabel *lblBarCodeTest=[[UILabel alloc]initWithFrame:CGRectMake(0,100,768,30)];
[lblBarCodeTest setBackgroundColor:[UIColor lightGrayColor]];
[lblBarCodeTest setTextAlignment:NSTextAlignmentCenter];
[lblBarCodeTest setFont:fntCode39];
[lblBarCodeTest setText:@"*BarCode3Of9_AKA_Code39-ItsA1DBarcode*"];
[self.view addSubview:lblBarCodeTest];结果:

https://stackoverflow.com/questions/5759073
复制相似问题