【发布时间】:2016-01-15 03:50:32
【问题描述】:
我希望 TabBarController 的所有子视图都可以访问相同的信息。
我有一个导航控制器,可以让用户选择一行。当它被选中时,它将NSMutableDictionary 推送到 TabBarController 中的第一个 ViewController。布局见截图。
这很好,但我如何让其他视图访问同一条信息?
字典包含大量信息,我想将其拆分到其他屏幕中。
来自我的 UINavigationController
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
UITabBarController *tbc = (UITabBarController*)segue.destinationViewController;
CallDetailViewController *dv = [tbc childViewControllers][0];
dv.thisDictionary = Some dictionary;
}
在我的选项卡中的第一个 UIViewController 结束
@interface CallDetailViewController : UIViewController
@property (weak, nonatomic) NSMutableDictionary* thisDictionary;
@end
我需要在每个 UIViewController 上都有一个 NSMutableDictionary 吗?或者我可以调用一些主字典文件吗?
值得注意的是,我目前没有使用 UITabViewController 文件。
【问题讨论】:
标签: ios objective-c uinavigationcontroller uitabbarcontroller