【发布时间】:2012-07-27 07:41:06
【问题描述】:
我的应用程序有一个主屏幕 (mainView)。在mainView,我有一个按钮。当用户点击它时,我使用
[self presentViewController:libraryView animated:YES completion:nil]
呈现另一个视图 (libraryView)。然后,在libraryView,我使用
[self.view addSubview:tabBarController.view]
添加一个UITabBarController,它有2个视图控制器:featuredBooks和recentBooks
一切正常。但是当我在featureBooks添加一个按钮来关闭libraryView并返回mainView时,以下方法不起作用
[self dismissViewControllerAnimated: YES completion:nil]
[self.parentViewController dismissViewControllerAnimated: YES completion:nil]
[self.presentingViewController dismissViewControllerAnimated: YES completion:nil]
我知道原因:self 指的是featureBooks 的观点,而不是libraryView。
那么,我如何引用libraryView,将其关闭并从标签栏控制器内的视图控制器(featureBooks 或recentBooks)返回到mainView?
非常感谢。
【问题讨论】:
标签: ios xcode uitabbarcontroller dismiss