How to trigger method “tabBarController:didSelectViewController:” programmatically?

后端 未结 2 764
攒了一身酷
攒了一身酷 2021-01-13 00:00

Currently, I am trying to trigger the \'didSelectViewController\' method programmatically via the following code:

self.tabController.selectedViewController 
         


        
2条回答
  •  暖寄归人
    2021-01-13 00:24

    self.tabController.selectedIndex = NEWSTAB_INDEX;   // to actually switch to the controller (your code would work as well) - not sure if this does or not send the didSelectViewController: message to the delegate
    [self.tabController.delegate tabBarController:self.tabController didSelectViewController:[self.tabController.viewControllers objectAtIndex:NEWSTAB_INDEX]];  // send didSelectViewController to the tabBarController delegate
    

提交回复
热议问题