ちょっと引っ掛かったのでメモ。
標準
編集不可にする
TabBarController.m
self.customizableViewControllers = nil;
ただし!(ここで引っ掛かった)
customizableViewControllers = nil
の後でviewControllers
を変更するとcustomizableViewControllers
が初期化されてしまう。
例えば、こんなことをすると、
TabBarController.m
//編集不可にする
self.customizableViewControllers = nil;
//ViewControllerを追加する
NSMutableArray *array = self.viewControllers.mutableCopy;
UIViewController *vc = UIViewController.new;
vc.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemMostViewed tag:0];
[array addObject:vc];
self.viewControllers = array;
なので、順番を逆にする。
TabBarController.m
//ViewControllerを追加する
NSMutableArray *array = self.viewControllers.mutableCopy;
UIViewController *vc = UIViewController.new;
vc.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemMostViewed tag:0];
[array addObject:vc];
self.viewControllers = array;
//編集不可にする
self.customizableViewControllers = nil;