我有UINavigationController
,当事件触发时,我需要自定义UIView
显示在NavigationBar
下方,但不会阻碍当前ViewController
。 1}}我需要在控制器弹出/推送时保持持久性。
UIView
我目前正在设置我的 -----------------
| Status Bar |
-----------------
| Nav Bar |
-----------------
| Custom View |
-----------------
| |
| View Controller |
| |
-----------------
框架,如:
CustomView (UIView)
这是解决这个问题的方法吗?
答案 0 :(得分:0)
- (id)initWithNavigationController:(UINavigationController *)navController {
CGRect viewFrame = navController.view.frame;
if (self = [super initWithFrame:CGRectMake(viewFrame.origin.x,
navController.navigationBar.frame.origin.y + navController.navigationBar.frame.size.height,
viewFrame.size.width,
40.0)]){
self.navController = navController;
}
return self;
}
然后
CustomView* _myCustomView = [[CustomView alloc] initWithNavigationController:navigationController];
[navigationcontroller.view addSubview:_myCustomView];