How to disable the edit button that appears in the more section of a UITabBarController?

前端 未结 16 1041
借酒劲吻你
借酒劲吻你 2020-12-02 11:30

In my application (based on the Tab bar application XCode template) I use a UITabBarController to display a list of different sections of the application that the user can a

16条回答
  •  星月不相逢
    2020-12-02 11:56

    I was able to get this working with the following code. I created a CustomTabViewController and then modified my Tab Bar Controller's Class Identity in Interface Builder to use this custom class. Here is the code that it uses (.h and .m file contents). The key is setting the property to nil, which causes the Edit button to not be displayed. For details see: http://developer.apple.com/library/ios/documentation/uikit/reference/UITabBarController_Class/Reference/Reference.html#//apple_ref/occ/instp/UITabBarController/customizableViewControllers "If the array is empty or the value of this property is nil, the tab bar does not allow any items to be rearranged."

    #import 
    
    @interface CustomTabBarController : UITabBarController {
    
    }
    @end
    
    #import "CustomTabBarController.h"
    
    
    @implementation CustomTabBarController
    
    - (void)viewDidLoad
    {
        self.customizableViewControllers = nil;
        [super viewDidLoad];
    }   
    
    @end
    

提交回复
热议问题