Jan*_*ano 31
唯一可以做到这一点的免费图书馆是Cocoa-Touch- Barcodes,这是一个cocoabarcodes的分支.如果你正在考虑商业图书馆,有一个名为iPhone条形码生成器.
更新检查ZXing的这个objective-c端口:https://github.com/TheLevelUp/ZXingObjC
小智 15
包括:#import "NKDBarcodeFramework.h"在你的头文件中,并将这些行放在你的init函数中.
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;
Run Code Online (Sandbox Code Playgroud)
玩得开心 :-)
有很多条形码类型
每种条形码类型都有很多子类型,每种都有自己的用途.
我解释了如何生成One D条形码类型代码39之一
在这里,我解释如何使用自定义字体生成该条形码
脚步:
1)从这里下载自定义字体
2)从下载的zip中附加文件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];
Run Code Online (Sandbox Code Playgroud)
结果:

您可以使用CoreImage生成条形码图像.CoreImage包含4个生成不同条形码的过滤器:CICode128BarcodeGenerator,CIQRCodeGenerator,CIPDF417BarcodeGenerator,CIAztecCodeGenerator.
| 归档时间: |
|
| 查看次数: |
33091 次 |
| 最近记录: |