在UIPageViewController中渲染ZXingWidgetController

时间:2014-03-07 17:00:48

标签: ios zxing qr-code uipageviewcontroller addsubview

我正在使用ZXing库,特别是对象ZXingWidgetController来扫描qr-code。对象被插入到具有3页的UIPageViewController中(应用程序在第二页开始,而对象在第一页中)。当我滚动到第一页时,相机预览没有开始,但如果我尝试返回第二页(没有离开手指,在我开始滚动的同一时刻)预览开始工作。当我向上滚动到第一页时,我需要启动相机预览。这是我的代码:

widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:NO OneDMode:NO];

QRCodeReader* qRCodeReader = [[QRCodeReader alloc] init];
NSSet *readers = [[NSSet alloc] initWithObjects:qRCodeReader,nil];
widController.readers = readers;

[self.view addSubview:widController.view];

1 个答案:

答案 0 :(得分:0)

解决

ZXingWidgetController直接插入UIPageViewController。在它插入UIViewController容器之前,然后插入UIPageViewController。