嘿伙计们,我想获得我UITabbarController在相关内部的选定索引UIViewControllers。我试图得到parentViewControllerwith[self parentViewController];但似乎,这不是正确的方法,因为我得到的控制器没有类似的方法selectedIndex。有什么建议么 ?
1454 次
3 回答
2
int i = [self.tabBarController selectedIndex];
NSLog(@"Selected Index = %d",i);
于 2012-10-30T09:35:23.493 回答
2
访问 tabBarController 的selectedIndex属性
tabBarController.selectedIndex
于 2012-10-30T09:35:58.187 回答
2
这样做很容易。想象一下,你有 4 个图标在TabBarcontroller. 如果您想访问其中任何一个,您必须执行以下操作:
[self.tabBarController setSelectedIndex:0];
[self.tabBarController setSelectedIndex:1];
[self.tabBarController setSelectedIndex:2];
[self.tabBarController setSelectedIndex:3];
索引是tabBar中的位置
于 2012-10-30T09:36:12.460 回答