Hide UIToolbar UIBarButtonItems

后端 未结 6 1509
[愿得一人]
[愿得一人] 2020-12-03 08:12

I have a UIToolbar that I set up using IB with three buttons, left, middle and right. In some situations I would like to not display the middle button. Does anybody know of

6条回答
  •  猫巷女王i
    2020-12-03 08:36

    Reset the items:

    -(void)setItems:(NSArray *)items animated:(BOOL)animated
    

    You can get the current items using the items property, then just remove the one you don't want to show and pass in the new NSArray.

    As you can see, you can also animate it to make it clear to the user.

提交回复
热议问题