4

In my old app I could completely disable rearranging views in tab bar controller by doing:

tabBarController.customizableViewControllers = [NSArray arrayWithObjects:nil];

But on iOS4, the Edit button is still displayed, although it displays no items. Is not it possible to hide the edit button completely?

leppie
  • 115,091
  • 17
  • 196
  • 297
adranale
  • 2,835
  • 1
  • 21
  • 39
  • What is the edit button?? Is that a button that you made? A tab bar item? UIBarButtonItem?? – gabaum10 Oct 22 '10 at 18:09
  • in a tabBarController, if you have more than 5 Views, a "more" view will appear which contains the rest of the views. This "more" view has an edit button that allows the user to rearrange views. I did not want this in my app, and I could not disable it in iOS4.0 – adranale Nov 06 '10 at 21:21
  • hi adranale, i have same problem, if you solve this please tell me. my id is velugoti.nanda@gmail.com – good guy Jan 13 '11 at 09:07

3 Answers3

4

Add below function in app delegate.m file;

/*  code to remove edit button in more view */

- (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;
}
hypercrypt
  • 15,389
  • 6
  • 48
  • 59
0

Just for the record:

Under iOS4.1 the edit button does not appear any more when setting the customizableViewControllers to empty array.

Looks like Apple solved the problem.

adranale
  • 2,835
  • 1
  • 21
  • 39
  • Hi, I have same problem. I have tried as you specified. But still It is showing the edit button. – Satya Mar 24 '11 at 08:54
  • As I mentioned, it was mysteriously resolved! Which iOS version are you using? – adranale Mar 24 '11 at 14:37
  • I am using iOS4.2 and I tried by changing the deployment target from 3.0 to 4.2. But no luck with any iOS. – Satya Mar 25 '11 at 04:27
0

Try to comment out the line

//  tabBarController.customizableViewControllers = [NSArray arrayWithObjects:nil];

it works for me :-)