【发布时间】:2014-03-13 19:14:48
【问题描述】:
我需要在 iOS 应用中创建一个导航,如下图所示。
它包含一个标签栏和一个侧边菜单。
问题是右侧的导航菜单按钮,应该在所有选项卡中都可见。甚至每个选项卡的所有内部屏幕。
当用户从侧面菜单中选择一个选项时,它应该显示在屏幕上。
现在每个选项卡都应该可以从每个选项中访问,并且每个选项菜单应该可以在每个选项卡中访问。它就像 DB 中的多对多关系。
我应该如何设计它?
到目前为止,我已经尝试过。
- 在每个选项卡中,都有一个
containerViewController。其中包括我的FrontViewController和SideMenuViewController。 - 当从侧面菜单中选择一个选项时,会向
containerViewController传递一条消息,该消息会从视图中删除旧的FrontViewController并添加新的OptionViewController。 -
containerViewController中添加了菜单按钮和导航栏,以便每次在任何屏幕上都可以看到。
问题
现在使用这种方法面临一些问题。
-
由于
containerViewController中添加了导航栏。我可以使用我的FrontViewController的parent属性访问它。假设如果我需要在我的FrontViewController中使用PushViewController,我必须使用parent属性。像这样[self.parent.navigationController pushViewController:newVC animated:YES ];[self.parent.navigationController popViewControllerAnimated:YES]; 我必须在每个选项卡中使用这种方法。表示代码重复了 5 次。
谁能提出一个简单的解决方案。任何帮助表示赞赏。
【问题讨论】:
标签: ios iphone objective-c ipad uinavigationcontroller