Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an interception point like prepareForSegue for the TabBarController?

I am looking to do some controller configuration to the presented controller off a Tab Bar Controller. Is there a nice interception point where I can pass in some values to the destination controller, much like the prepareForSegue method?

Much appreciated.

like image 694
Slappy Avatar asked Jun 04 '12 01:06

Slappy


1 Answers

All your controllers from a tabview are accesible through the array of the tabviewcontroller. You can modify them directly there. If you are looking to change something before the user sees that specific one, set the delegate and implement the delegate method. (you can simply change the vc inside this method and return yes)

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
like image 114
Pochi Avatar answered Oct 19 '22 04:10

Pochi