タップされたボタンがタップされたときに別のビューからRootViewに移動する
-
02-01-2020 - |
質問
このコードを使用して、タブ(RootView)をプログラムで変更することを使用しています。
NSInteger tabitem = tabBarController.selectedIndex;
[[tabBarController.viewControllers objectAtIndex:tabitem] popToRootViewControllerAnimated:YES];
.
しかし、ビューからタブを変更するためのボタンを使用したい場合は、RootViewを表示できません。私はこのコードを使っていますが、RootView:
は表示されませんself.tabBarController.selectedIndex = 3;
. 解決
これは解決策です:
https://stackoverflow.com/a/12681125/3507283
int index = 3;
self.tabBarController.selectedIndex = index;
[self.tabBarController.viewControllers[index] popToRootViewControllerAnimated:NO];
. 所属していません StackOverflow