Hello!

The task is to show PopOver 'om ViewController by clicking on an item in the tab bar. How can I deceive the standard behavior so that instead of showing a tab by clicking on the tab bar element, the old tab remains and my action is performed, in this case, pop-over?

Ready to provide any necessary information.

Thank!

    1 answer 1

    You need to override the didSelectItem method on UITabBarDelegate

     - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item 

    determine whether the item was selected (for this you can use the tag field, since UITabBarItem is a direct descendant of UIBarItem ) and after that do what your heart desires.

    • 3
      but it is better not to do so. in fact, this is the wrong desire. if there is a need for such an action, then the project has either potential problems with the design of the design or with an understanding of the Apple HIG. - dive
    • one
      In addition, they will be rejected if you plan to set it to appstore, since such a redefinition of standard elements is not allowed in HIG. Better find a more suitable control for this purpose - AlexThumb
    • Well, even though it was not a solution, the answer gave me an idea. Instead of UITabBarDelegate, I used the method UITabBarControllerDelegate - shouldSelectViewController It allows you to return NO; and the new tab just does not seem. The required class is instantiated immediately, the display coordinate is calculated. Unfortunately, the text limit on the comment is not enough to bring the decision completely. Thank you all, colleagues! - Dan