iPhone iOS:您可以在 ZBar 条码扫描中添加十字准线或其他视觉指示器吗?
我想知道在 iPhone/iOS 应用程序中使用 Zbar 条形码扫描时是否可以在屏幕上添加某种类型或十字准线或其他视觉指示器,以帮助用户将相机瞄准 QR 码?
I want to know if it is possible when using Zbar barcode scanning within an iPhone/iOS app to add some sort or crosshairs or other visual indicator to the screen to assist users in aiming their camera onto a QR code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好使用透明的 PNG 来实现这一点。只需将其导入到您的项目中,然后创建一个新的
UIImageView
并将其提供给读者。我这样做是为了添加一个徽标:
要使图像位于中心,只需将框架定位从:
更改为:
That is best accomplished with a transparent PNG. Just import it to your project and then create a new
UIImageView
that you give to the reader.I did this to add a logo:
To get the image in the center just change the frame positioning from:
To something like:
FWIW 我在我的应用程序中所做的是扩展 ZBarReaderViewController 类,将我的新类也设置为 ZBarReaderDelegate,然后将 JeroenEijkhof 的代码放入我的 init 覆盖中:
这使我能够控制视图的其他方面,例如自定义
viewDidLoad
和viewWillAppear
上的导航控制器,因为我在 NavigationController 视图堆栈中实现相机视图,并且希望能够添加标题栏、工具栏等,而不是以模态方式呈现它,如 zbar 文档所示。FWIW what I did in my app is to extend the ZBarReaderViewController class, set my new class as the ZBarReaderDelegate also, and then put JeroenEijkhof's code into my init override:
This gave me the ability to control other aspects of the view, such as customizing the navigation controller on
viewDidLoad
andviewWillAppear
since I was implementing the camera view in a NavigationController view stack and wanted the ability to add the titlebar, toolbar, etc. instead of presenting it modally, as the zbar docs demonstrate.