プロパティで変数UITabBarController *myTabBarController;
を作成し、あなたがTabBarItem
を無効にしたいあなたのViewController
では、私は同じ問題を抱えていたし、私は解決策を発見した(私はそれが少し汚れて見つける。)
。戻ってあなたのViewController
クラス(MyViewController
)に今
MyViewController * vc = (MyViewController *)[navigationController.viewControllers objectAtIndex:0];// O the index of the first view controller replace it with the index of the needed viewController
vc.myTabBarController = myTabBarController; // pass your TabBarController to your ViewController
とtabBarItem
を無効にするには、このコードを使用します:
UITabBarItem *mapTabBarItem= [[myTabBarController.tabBar items] objectAtIndex:1]; // I want to desable the second tab for example (index 1)
[mapTabBarItem setEnabled:NO];
あなた
Tabbarcontroller
viewDidLoad
にこのコードを入れて管理するクラスで
これは最善の方法ではありませんが、それはうまく動作します:-)