简体   繁体   中英

Hiding UITabBar when showing UIViewController as modal

I've got a UIViewController that has a modal window which I'd like to present over the entire interface, including the UITabBar.

My application hierarchy is this:

UITabBarController (A) ->
    UIViewController (B) ->
        UINavigationController (C) ->
            UIViewController (D) ->
                UIViewController (my modal view)

When I call presentModalViewController on D, the modal view is presented but underneath the UITabBar, or should I say, the UITabBar is still shown.

I've tried setting the hidesBottomBarWhenPushed property to YES on the modal view controller, but to no avail.

Any ideas on why this isn't working for me?

The modal ViewController needs to be a direct child of the TabBarController in order to do what you want.

in ViewController "D", instead of :

[self presentModalViewController:...];

do:

[tabBarController presentModalViewController:...];

how you maintain a reference to the TabBarController is up to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM