public enum CodeDescriptor: String {
case qrCpde = "CIQRCodeGenerator"
//只能识别 ascii characters
case code128Barcod = "CICode128BarcodeGenerator"
//显示中文会乱码
case pdf417 = "CIPDF417BarcodeGenerator"
//显示中文会乱码
case aztec = "CIAztecCodeGenerator"
}
enum CodeKey:String{
///设置内容
case inputMessage = "inputMessage"
///设置容错级别
case inputCorrectionLevel = "inputCorrectionLevel"
}
/// 容错级别
/*
qrCpde 和 pdf417
inputCorrectionLevel 是一个单字母(@"L", @"M", @"Q", @"H" 中的一个),表示不同级别的容错率,默认为 @"M"
QR码有容错能力,QR码图形如果有破损,仍然可以被机器读取内容,最高可以到7%~30%面积破损仍可被读取
相对而言,容错率愈高,QR码图形面积愈大。所以一般折衷使用15%容错能力。错误修正容量 L水平 7%的字码可被修正
M水平 15%的字码可被修正
Q水平 25%的字码可被修正
H水平 30%的字码可被修正
code128Barcod 不能设置inputCorrectionLevel属性
aztec inputCorrectionLevel 5 - 95
*/
public enum CorrectionLevel{
case L
case M
case Q
case H
case aztecLevel(_ value:Int)
var levelValue:String{
switch self {
case .L:
return "L"
case .M:
return "M"
case .Q:
return "Q"
case .H:
return "H"
default:return "" }
iOS 生成二维码(Swift)
最新推荐文章于 2024-05-29 14:11:41 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)