2
我正在使用Storyboard創建具有6個選項卡的選項卡欄。標籤欄是初始視圖控制器。我沒有爲我的tabbarcontroller使用任何自定義類。更多的標籤獲得一個「編輯」按鈕。我怎樣才能刪除該按鈕?從更多選項卡欄應用程序中禁用編輯按鈕
我正在使用Storyboard創建具有6個選項卡的選項卡欄。標籤欄是初始視圖控制器。我沒有爲我的tabbarcontroller使用任何自定義類。更多的標籤獲得一個「編輯」按鈕。我怎樣才能刪除該按鈕?從更多選項卡欄應用程序中禁用編輯按鈕
最後創建一個自定義類爲我的TabBarController,這樣做,
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated {
UINavigationBar *morenavbar = navigationController.navigationBar;
UINavigationItem *morenavitem = morenavbar.topItem;
/* We don't need Edit button in More screen. */
morenavitem.rightBarButtonItem = nil;
}
這解決了這個問題。
將tabBarController的customizableViewControllers設置爲nil。
tabBarController.customizableViewControllers = nil;
這需要在tabBarController上設置選項卡後完成,如果您更改它們 – Jarada
但是如果您正在使用類似問題的故事板問的問題,那麼在哪裏添加此選項? –