Select no tabs in a UITabBar

后端 未结 7 1545
心在旅途
心在旅途 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 20:04

    I finally managed to do this using the following code:

            DefaultView *defaultView = [[DefaultView alloc]initWithNibName:@"DefaultView" bundle:[NSBundle mainBundle]];
            [self.tabBarController setSelectedViewController:nil];
            [self.tabBarController setSelectedViewController:defaultView];
    

    Note that just doing [self.tabBarController setSelectedViewController:nil]; won't do anything. You HAVE TO specify a view controller. This view Controller will be displayed with no tabBar icon selected. Upon selecting the other TabBar options, the defaultView will disappear and the required view will be loaded.

    0 讨论(0)
提交回复
热议问题