我的应用程序是基于导航的 iPad 应用程序。
第一个屏幕是主屏幕。在主屏幕上单击按钮时,它会推送到 map 屏幕。在 map 屏幕上,我将面板( View Controller )留在占据屏幕 1/4 的 map View Controller 上。
左面板是一个具有 TableView 的 View Controller 。单击单元格时,它应该将新的 View Controller 推送到左侧面板,留下 map View Controller 。
Push
Home Screen -------- Map Screen
|(Added over map screen) Push
|----- Left Panel (Table View) -------- Detail View
我无法使用 Split View Controller,因为左侧面板和主屏幕中都有导航。有时我需要动画/隐藏左面板。我可以自定义左侧面板。
如何实现这个结构。使用 Nested Navigation Controller 好还是有可用的库。我的应用程序支持纵向和横向。我正在使用 Swift。
最佳答案
对不起,我也不了解 Swift。但是,我认为你必须声明一个基本布局:
您将拥有一个包含 LeftPanelViewController
和 FrontViewController
的 MainViewController。在 MainViewController nib 中,您将使用 AutoLayout
创建主布局:在屏幕左侧添加一个 UIView,为首页添加另一个 UIView。
然后,链接网点,您将完成布局!然后,您只需向 leftPanelView
和 FrontView
添加/删除 subview 。
现在,我认为正确的逻辑是 MainViewController
是 NavigationController
,所以你必须实现 LeftPanelViewController
和 FrontViewController
,因此 Main 将知道如何以及何时添加/删除 subview 。
重要的是没有一个对象必须知道 MainViewController
的存在才能保留逻辑。所以你必须通知 MainViewController
一些东西,使用 delegation pattern
或其他东西作为 NSNotification
(注意,它可能很重.. .)
希望对您有所帮助。再见
关于ios - 如何处理此设计 - iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27875377/