make invisible a UIBarButtonItem

2019-08-20 02:53发布

问题:

I can make an invisible UIBarButtonItem on UIToolbar, inserted with XCode / Storyboard? I have found a property to disable it: enabled = NO, but is not made it invisible

回答1:

    NSMutableArray *items = [YourToolBar.items mutableCopy];
    [items removeObject:BarButton];
    YourToolBar.items = items;
    [items release];