2

I am new in iOS. I use Seven Tab bar item in my tab bar controller story board and when run app then it shows more buttons when I click on it it is also show edit button. I do not want that edit button. How can this be done?

This is my code:

[[[tabBarController moreNavigationController] visibleViewController] setTitle:@""];

But it does not work.

Jørgen R
  • 10,568
  • 7
  • 42
  • 59
Ashish Gabani
  • 445
  • 1
  • 5
  • 30
  • possible duplicate of [How to disable the edit button that appears in the more section of a UITabBarController?](http://stackoverflow.com/questions/825066/how-to-disable-the-edit-button-that-appears-in-the-more-section-of-a-uitabbarcon) – eMi Oct 06 '14 at 10:18
  • But it is not working for me @jurgemaister – Ashish Gabani Oct 06 '14 at 10:40
  • there it use "tabBarController". so make a IBOutlet of that tab bar or only a UITabBarController. – Ashish Gabani Oct 06 '14 at 10:45

2 Answers2

11

You had to say that none of your view controllers is customizable. Then the edit button disappears. Please look up the docs.

tabBarController.customizableViewControllers = @[];  

Docs: "This property controls which items in the tab bar can be rearranged by the user. When the user taps the More item on the tab bar view, a custom interface appears displaying any items that did not fit on the main tab bar. This interface also contains an Edit button that allows the user to rearrange the items. Only the items whose associated view controllers are in this array can be rearranged from this interface. If the array is empty or the value of this property is nil, the tab bar does not allow any items to be rearranged."

Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
  • yes sir i not use any custumizable view but i use 7tab item so it is show me more section with edit button but i not want to that edit button – Ashish Gabani Oct 06 '14 at 11:01
  • Your tabBarController controls a number of viewControllers, one for each tab. The edit button is for rearranging the tabs, i.e. the view controllers. If you set the property customizableViewControllers of the tabBarController to an empty array or to nil, none of your tabs can be rearranged, and the edit button will not be active. – Reinhard Männer Oct 06 '14 at 11:04
  • The code is the single line that I gave you in my answer. – Reinhard Männer Oct 06 '14 at 11:08
  • i write code for that but not working tabbarcontroller.customizableViewControllers = [NSArray arrayWithObjects:nil]; – Ashish Gabani Oct 06 '14 at 11:15
2

On Swift: You can also have those items you want to be editable in the array:

tabBarController.customizableViewControllers = []

Ensure that if you have a navigation controller for the tabbar controller that it is not translucent because the more navigation bar will be behind the main navigation bar. This sometimes shows an empty space above the more tableview.

You can completely hide the more navigation controller if you do not need it, since tapping the more tab pops the top view controller.

tabBarController.moreNavigationController.navigationBar.isHidden = true

dev_exo
  • 164
  • 1
  • 8