模态试图(presentViewController)显示UINavigationBar

    在模态试图里,是不会被父试图劫持的,所以在打开模态试图的时候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也是一样的.

原文地址:https://www.cnblogs.com/mohe/p/3054681.html