在模态试图里,是不会被父试图劫持的,所以在打开模态试图的时候NavigationBar 是一个nil值.

    如果要在模态试图里显示UINavigationBar的话,我们得这么做:

  

    WritenViewController *writenView = [[WritenViewControlleralloc] init];

    UINavigationController *presNavigation = [[UINavigationControlleralloc] initWithRootViewController: writenView]; //创建一个NavigationController

    [selfpresentViewController: presNavigation animated: YEScompletion:^{

        NSLog(@"");

    }];

    [writenView release];

    [presNavigation release];

   这样在WritenViewController里NavigationBar就可以正常显示了.

同理Toolbar也是一样的.

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-03-09
  • 2021-11-05
  • 2021-07-02
  • 2021-07-27
  • 2021-12-07
猜你喜欢
  • 2022-12-23
  • 2021-12-31
  • 2021-05-06
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案