为什么我的子视图没有显示在堆栈顶部?

Why is my subview not showing on top of the stack?

我正在尝试在我的 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");
}

您似乎在初始化 self.capture 之前为 self.capture 设置了 delegate。初始化 self.capture 后尝试设置 delegate