문제

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?

도움이 되었습니까?

해결책

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;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top