iPhone iOS : Can you add crosshairs or other visual indicator to ZBar barcode scanning?

标签 iphone ios qr-code barcode-scanner zbar-sdk

我想知道在 iPhone/iOS 应用程序中使用 Zbar 条形码扫描时是否可以在屏幕上添加某种排序或十字线或其他视觉指示器以帮助用户将相机对准 QR 码?

最佳答案

这最好用透明的 PNG 来完成。只需将它导入您的项目,然后创建一个新的 UIImageView 并提供给读者。

我这样做是为了添加 Logo :

// Create the reader
self.reader = [ZBarReaderViewController new];
self.reader.readerDelegate = self;

// Create image for adding a logo :)
UIImage *image = [UIImage imageNamed:@"scan_logo.png"];
UIImageView *imageLogo = [[UIImageView alloc] initWithImage:image];
imageLogo.frame = CGRectMake(0, 0, image.size.width, image.size.height);

// Configure reader
self.reader.cameraOverlayView = imageLogo;

要使图像居中,只需更改框架定位:

imageLogo.frame = CGRectMake(0, 0, image.size.width, image.size.height);

类似于:

imageLogo.center = CGRectMake(320/2, 460/2, image.size.width, image.size.height);

关于iPhone iOS : Can you add crosshairs or other visual indicator to ZBar barcode scanning?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6248745/

相关文章:

iphone - 如何完全删除并释放 OpenAL 声音文件的内存?

iphone - 将 [super viewDidLoad] 放在我的 UIViewController 中有什么不同吗?

android - 用 ActionScript3 而不是 Java/Objective-C 编写手机游戏是个好主意吗?

iphone - iPhone 上的摇动视觉效果(不是摇动设备)

qr-code - 使用 CIQRCodeDescriptor initWithPayload : symbolVersion: maskPattern errorCorrectionLevel: 生成二维码

ios - 扫描名片 Tesseract 和 Leptonica iOS

ios - Objective C 中的蓝牙配对与连接

ios - Ionic iframe 加载在 iOS 上无法完全运行

qr-code - 适用于 Android 的 QR 码阅读器

ios - Swift 将数据编码成 URL