【发布时间】:2017-11-03 10:30:12
【问题描述】:
我正在尝试添加一个需要在堆栈顶部显示的子层 (UINaviationController),它显示得很好,但是当我尝试关闭视图时,我无法让它正常工作,它要么关闭整个 UINavigtioncontroller 并杀死整个堆栈,或者它只是删除我的部分视图并在顶部留下黑屏。
我需要的是让我的 subView 显示在堆栈顶部,并能够在我的委托被调用后从堆栈中弹出它
代码如下
在这里创建子视图
- (IBAction)transactionListViewCameraBtn_Pressed:(id)sender {
if([NWTillHelper isDebug] == 1) {
NSLog(@"%s entered", __PRETTY_FUNCTION__);
}
self.capture = [[ZXCapture alloc] init];
self.capture.camera = self.capture.back;
self.capture.focusMode = AVCaptureFocusModeContinuousAutoFocus;
[self.view.layer addSublayer:self.capture.layer];
[self.view bringSubviewToFront:self.scanRectView];
[self.view bringSubviewToFront:self.decodedLabel];
self.capture.delegate = self;
[self applyOrientation];
}
这就是我试图用来再次关闭子视图的方法,但它们都不起作用
[self.view removeFromSuperview];
//[self dismissViewControllerAnimated:YES completion:nil];
//[[self navigationController] popViewControllerAnimated:YES];
//[self removeFromParentViewController];
我一定错过了什么,但是什么?
【问题讨论】:
标签: ios objective-c addsubview