I have a UITabBarController
, if I push to different views from开发者_开发技巧 the first UITabBarItem
and I tap the first UITabBar
two times then the views that were pushed are popped back.
How can I simulate this exact functionality programatically?
You could implement the tabBarController:didSelectViewController:
method of your UITabBarController
to do this. You can manually count the number of taps on your UITabBar
in the AppDelegate
, and have certain conditions in the method.
For example, you could try in the .h file having an instance variable which stores the last UIViewController
selected, and the time it was selected. If you then check the last time the UIViewController
was called in same method, and it was a short enough period, then it would count as a double tap.
Hope that Helps!
精彩评论