Disable action - user taps on tabbar item to go to root view controller

六月ゝ 毕业季﹏ 提交于 2019-11-29 03:08:55

if you look at the UITabBarController delegate there is a method:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

If you implement this in your class, you can check if the UIViewController is the already displayed one and then return NO, which will stop this from happening.

I had the same problem with a ABPeoplePicker object embedded in a UITabBarController, in that pressing the 'Contacts' tab a second time which was already displayed would make the ABPeoplePicker control show the 'Groups'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!