Sie haben versucht, TabBarController: shouldSelectViewController: Delegatmethode? Ich hoffe, das sollte dir helfen.
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
id currentViewController = tabBarController.selectedViewController;
return (viewController != currentViewController);
}
Wenn alle View-Controller des Tab-Bar-Controllers UINavigationControllers sind, sollten Sie es so machen.
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
id nextVC = [(UINavigationController *)viewController topViewController];
id currentVC = [(UINavigationController *)tabBarController.selectedViewController topViewController];
return (nextVC != currentVC);
}
ich diese Methode gefunden, aber was für Code in es gehen muss ..., dass ich nicht sicher bin. – viral
In Ordnung. Siehe meine aktualisierte Antwort. – EmptyStack
Ja, alle VCs sind 'UINavigationControllers'. Irgendein bestimmter Grund, um '' (UINavigationController *) ''zu schreiben oder nur aus Gründen der guten Programmierpraxis. Es funktioniert auch ohne. – viral