Select no tabs in a UITabBar

后端 未结 7 1546
心在旅途
心在旅途 2020-12-06 19:23

I\'m trying to select no tabs at all in my application. At first the first tab is selected, but I\'d like to deselect it so no tabs at all would be selected.

Don\'t

7条回答
  •  自闭症患者
    2020-12-06 19:44

    You can deselect all tab bar items if you are using UITabBar instance without UITabBarController one.

    In such case below code works well.

    [tabBar setSelectedItem:nil];
    

    If UITabBar is a part of UITabBarController then application will crash with exception:

    'Directly modifying a tab bar managed by a tab bar controller is not allowed.'

    In other words if you would like to get this worked you need to manage tabbar's routines manually without controller.

提交回复
热议问题