控制嵌套的 UITabController
Controlling a nested UITabController
我有两个 UITabController
。一个可以从嵌套在第一个 UITabController
范围内的 UIViewController
控制(在层次结构中较低)。当我更改层次结构较低的 selectedIndex
时,它也会更改另一个。我已经尝试了很多东西(见下文),但似乎没有任何效果。知道我如何控制一个而不是另一个。
// Controls both
self.tabBarController!.selectedIndex = curTab
// Doesn't do anything
(self.storyboard?.instantiateViewController(withIdentifier: "SecondTabBar") as! UITabBarController).selectedIndex = curTab
// Where stb is via classes to the storyboard of UITabController also doesn't work
stb.selectedIndex = curTab
I have two UITabControllers. One is controllable from UIViewControllers that are nested within the scope of the first UITabController (lower in the hierarchy).
在另一个标签栏控制器中包含一个标签栏控制器is not a supported configuration。
我有两个 UITabController
。一个可以从嵌套在第一个 UITabController
范围内的 UIViewController
控制(在层次结构中较低)。当我更改层次结构较低的 selectedIndex
时,它也会更改另一个。我已经尝试了很多东西(见下文),但似乎没有任何效果。知道我如何控制一个而不是另一个。
// Controls both
self.tabBarController!.selectedIndex = curTab
// Doesn't do anything
(self.storyboard?.instantiateViewController(withIdentifier: "SecondTabBar") as! UITabBarController).selectedIndex = curTab
// Where stb is via classes to the storyboard of UITabController also doesn't work
stb.selectedIndex = curTab
I have two UITabControllers. One is controllable from UIViewControllers that are nested within the scope of the first UITabController (lower in the hierarchy).
在另一个标签栏控制器中包含一个标签栏控制器is not a supported configuration。