如何从 tabBarController 遍历所有导航控制器?
问问题
1743 次
3 回答
3
for (UIViewController *viewController in self.tabBarController.viewControllers)
{
// Do your thing...
}
于 2011-10-19T10:49:45.093 回答
1
for (UIViewController *viewController in tabBarController.viewControllers) {
// do something here
}
于 2011-10-19T10:50:31.647 回答
0
因为这个问题也被标记为 Swift。以下是您可以在 swift 中尝试的变体:
1.
tabBarController?.viewControllers?.forEach{ viewController in
}
2.
for viewController in tabBarController?.viewControllers ?? []{
}
3.
guard let array = tabBarController?.viewControllers else {return}
for viewController in array{
}
于 2019-08-06T05:43:31.553 回答