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 Edi开发者_开发问答t button is still displayed, although it displays no items. Is not it possible to hide the edit button completely?
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;
}
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.
Try to comment out the line
// tabBarController.customizableViewControllers = [NSArray arrayWithObjects:nil];
it works for me :-)
精彩评论