模態試圖(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也是一樣的.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM