Domanda

I'm working on an app and I would like to use the tab bar controller styling, but without the tabs. I would like it so that when I click on a tab button a function is run, but I don't want it to jump to a new tab. Is this possible and if so how do I do it?

È stato utile?

Soluzione

Yes it is possible.

Implement the UITabBarControllerDelegate protocol's tabBarController:shouldSelectViewController: method execute your code and return NO.

Example

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
     // Do your stuff here.

    return NO;
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top