Search code examples
iphoneobjective-ciosuinavigationcontrolleruitabbarcontroller

iOS how to dim UITabBar and UINavigationController without hiding them?


I'm trying to reduce the brightness of my app at night, and while I have pretty good control over my UIView, the UITabBar and UINavigationController are giving me trouble.

How can I dim UITabBar and UINavigationController them without hiding them?


Solution

  • For the UITabBar you could do:

    tabBar.alpha = 0.5
    

    A UINavigationController is not a view, it is a controller, thus it doesn't make sense when you say you want to dim it. If you meant that you want to dim the UINavigationBar, you could do:

    navigationController.navigationBar.alpha = 0.5;
    

    Or if you want to dim everything in the navigationController:

    navigationController.view.alpha = 0.5;