1.addChildViewController 在 base controller中添加子的controller,会自动调用子的controller中viewDidload,viewWillAppear等视图方法,可以完成一个controller叠加各种视图
2.base 的controller必须是UIViewController,如果是 UINavigationController,则没法控制子controller frame的大小
示例代码:
BaseNavController * nav = [[BaseNavController alloc] initWithRootViewController:agendaController];
nav.view.autoresizingMask = UIViewAutoresizingNone;
[nav.view addGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(dragView:)]];
[self addChildViewController:nav]; nav.view.frame = CGRectMake(270, -20, DeviceWidth - 270, DeviceHeight - 200);//homeViewLeftMenuViewWidth nav.view.backgroundColor = [UIColor yellowColor];
[self.view addSubview:nav.view];