Question

I constructed a tabbar with more than 5 tabs and the remainders were automatically added into the "More" view. That is fine, but along with that, the user is able to "Edit" the configuration of the app's tabs.

I do not want the user to be able to do that. Is there a way to prevent the user from doing this?

Was it helpful?

Solution

Take a look at the UITabBarController documentation. Search for "customizableViewControllers"

customizableViewControllers

The subset of view controllers managed by this tab bar controller that can be customized.

@property(nonatomic, copy) NSArray *customizableViewControllers

Discussion

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.

Changing the value of the viewControllers property (either directly or using the setViewControllers:animated: method) also changes the value of this property. When first assigned to the tab bar controller, all view controllers are customizable by default.

Basically what you have to do is use the following code, to set the value to nil:


- (void)applicationDidFinishLaunching:(UIApplication *)application
{
tabBarController.customizableViewControllers=nil;
}

Cheers,
VFN

OTHER TIPS

// 'Move view' customization
// MORE tab bar items 'More view'
- (void)applicationDidFinishLaunching:(UIApplication *)application {
  self.tabBarController.customizableViewControllers=nil;

  UIViewController  * moreController =
  [[self.tabBarController.moreNavigationController viewControllers] objectAtIndex:0] ;
  UITableView * moreTableView = ( UITableView *)  [moreController view];
  [moreTableView setSeparatorColor:[UIColor redColor]];
  [moreTableView setBackgroundColor:[UIColor yellowColor]];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top