2012-06-04 9 views

risposta

8

Tutti i controller da un tabview sono accessibili attraverso l'array del tabviewcontroller. Puoi modificarli direttamente lì. Se si sta cercando di modificare qualcosa prima che l'utente veda quello specifico, impostare il delegato e implementare il metodo delegato. (Si può semplicemente cambiare la vc all'interno di questo metodo e tornare sì)

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UITabBarControllerDelegate_Protocol/Reference/Reference.html

tabBarController:shouldSelectViewController: 

Asks the delegate whether the specified view controller should be made active. 
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController Parameters 

tabBarController 

    The tab bar controller containing viewController. viewController 

    The view controller belonging to the tab that was tapped by the user. 

Return Value 

YES if the view controller’s tab should be selected or NO if the current tab should remain active. Discussion 

The tab bar controller calls this method in response to the user tapping a tab bar item. You can use this method to dynamically decide whether a given tab should be made the active tab. Availability 

    Available in iOS 3.0 and later. 

Declared In UITabBarController.h 
+0

risposta brillante. Grazie – Slappy

+0

Questo non viene chiamato se la scheda viene cambiata in modo programmatico. – malhal

Problemi correlati