Frage

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?

War es hilfreich?

Lösung

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;
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top