IPhone Objective-C: disable stack popping when clicking on a tab using the navigation controller

Let's say I have a tab bar controller with tab A. A has a navigation controller that allows me to push new views onto the stack. Right now, if I touch A in the tab bar, all the items in the stack will appear.

Is there a good way to disable this? I have a sequence of views that are displayed with a navigation controller that accepts user input, I would not want all this to be lost with a finger slip.

Thanks in advance, and please let me know if my question is unclear.

+3
source share
1 answer

Try setting up a delegate for your UITabBarController and run:

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

If the same view controller is selected, return NO. Then the navigation stack should not change.

Please note that it will only be called for the same tab with which you are already connected with iOS 3.0, but for now I will only use iOS 3.0 +.

+2
source

Source: https://habr.com/ru/post/1756669/


All Articles