不同的setHidesBottomBarWhenPush在子视图和父视图控制器上

时间:2017-05-24 09:08:10

标签: ios uiviewcontroller

  1. 显示父vc上的底栏,当我将子vc添加到父vc时。
  2. 当我从父vc中删除子vc时,
  3. 然后隐藏父vc上的底栏。
  4. 怎么做?

    这是我当前的代码,没有setHidesBottomBarWhenPushed

    ParentVC:didload

    [self addChildViewController:childVC];
    [self.view addSubview:childVC.view];
    [childVC didMoveToParentViewController:self];
    

    针对子vc的行动

    [self willMoveToParentViewController:nil];
    [self.view removeFromSuperview];
    [self removeFromParentViewController];
    

1 个答案:

答案 0 :(得分:0)

试试这个

  UIViewController *yourViewController  = [self.storyboard instantiateViewControllerWithIdentifier:@"VCIdentifier"];

如果您需要导航栏

UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:objAddRatingVC];
 [navController setModalPresentationStyle:UIModalPresentationCurrentContext];
 [self.navigationController presentViewController:navController animated:YES completion:nil];

如果您不想要导航栏

[yourViewController setModalPresentationStyle:UIModalPresentationCurrentContext];
 [self.navigationController presentViewController:yourViewController animated:YES completion:nil];