設置childViewcontroller
self.ganZhi_vc = [board instantiateViewControllerWithIdentifier:@"HDGanZhiViewController"]; [self addChildViewController:self.ganZhi_vc]; self.data_vc = [board instantiateViewControllerWithIdentifier:@"HDDataViewController"]; [self addChildViewController:self.data_vc]; self.map_vc = [board instantiateViewControllerWithIdentifier:@"HDMapViewController"]; [self addChildViewController:self.map_vc]; self.code_vc = [board instantiateViewControllerWithIdentifier:@"HDCodeViewController"]; [self addChildViewController:self.code_vc]; [self.view addSubview:self.root_vc.view]; [self.root_vc didMoveToParentViewController:self]; _currentViewController = self.root_vc;
界面跳轉
-(void)changeViewControllerWith:(UIViewController *)temp { if (_currentViewController != temp) { __weak ViewController *weaSelf = self; [self transitionFromViewController:_currentViewController toViewController:temp duration:1.0 options:UIViewAnimationOptionLayoutSubviews animations:nil completion:^(BOOL finished) { }]; _currentViewController = temp; } }