objective-c – 如何以编程方式触发方法“tabBarController:didSelectViewController:”?

前端之家收集整理的这篇文章主要介绍了objective-c – 如何以编程方式触发方法“tabBarController:didSelectViewController:”?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
目前,我试图通过以下代码以编程方式触发’didSelectViewController’方法
self.tabController.selectedViewController 
        = [self.tabController.viewControllers objectAtIndex:NEWSTAB_INDEX];

但是,没有调用’didSelectViewController’方法.如何在不必手动选择标签栏的情况下触发该方法

@R_301_323@

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

猜你在找的C&C++相关文章