adranale
adranale

Reputation: 2874

Disabling edit button in "more" view of tab bar controller does not work in iOS4

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?

Upvotes: 4

Views: 1543

Answers (3)

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;
}

Upvotes: 4

user169964
user169964

Reputation:

Try to comment out the line

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

it works for me :-)

Upvotes: 0

adranale
adranale

Reputation: 2874

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.

Upvotes: 0

Related Questions