【发布时间】:2012-06-08 04:10:32
【问题描述】:
我希望通过标签栏控制器对呈现的控制器进行一些控制器配置。是否有一个很好的拦截点,我可以将一些值传递给目标控制器,就像 prepareForSegue 方法一样?
非常感谢。
【问题讨论】:
标签: ios model-view-controller uitabbarcontroller
我希望通过标签栏控制器对呈现的控制器进行一些控制器配置。是否有一个很好的拦截点,我可以将一些值传递给目标控制器,就像 prepareForSegue 方法一样?
非常感谢。
【问题讨论】:
标签: ios model-view-controller uitabbarcontroller
标签视图中的所有控制器都可以通过标签视图控制器的数组进行访问。您可以直接在那里修改它们。如果您希望在用户看到特定内容之前更改某些内容,请设置委托并实现委托方法。 (你可以简单地改变这个方法里面的vc并返回yes)
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
【讨论】: