我使用选项卡栏通过单个 TableView Controller 显示相同数据的三个过滤 View 。为了确定适当的过滤器,我需要找出从 subview Controller 中选择了哪个选项卡。我使用 Storyboard来创建此结构,因此我没有选项卡栏 View Controller 。
最佳答案
两种可能的方式:
在你的 subview Controller 中
UITabBarController *tvc = (UITabBarController *)self.parentViewController;
NSInteger 索引 = tvc.selectedIndex;
使用单例来保存 selectedIndex
关于ios - 如何从 subview Controller 中找到选项卡栏方案中选定的选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31040889/