我正在尝试在我的NavigationStack上添加一个摄像头捕获子视图,但即使代码根据调试运行正常,子视图也不会显示在顶部,所以我无法使用摄像头进行扫描
代码如下所示,为什么它不会显示在堆栈顶部?
- (IBAction)transactionListViewCameraBtn_Pressed:(id)sender {
if([NWTillHelper isDebug] == 1) {
NSLog(@"%s entered", __PRETTY_FUNCTION__);
}
NSLog(@"jongel1");
self.capture.delegate = self;
NSLog(@"jongel2");
[self applyOrientation];
NSLog(@"jongel3");
self.capture = [[ZXCapture alloc] init];
self.capture.camera = self.capture.back;
self.capture.focusMode = AVCaptureFocusModeContinuousAutoFocus;
NSLog(@"jongel4");
[self.view.layer addSublayer:self.capture.layer];
NSLog(@"jongel5");
[self.view bringSubviewToFront:self.scanRectView];
[self.view bringSubviewToFront:self.decodedLabel];
NSLog(@"jongel6");
}
答案 0 :(得分:2)
似乎在初始化delegate
之前为self.capture
设置了self.capture
。初始化delegate
后尝试设置self.capture
。