Hide UIToolbar UIBarButtonItems

后端 未结 6 1515
[愿得一人]
[愿得一人] 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条回答
  •  没有蜡笔的小新
    2020-12-03 08:47

    I know it is quite old thread for but those who look this page for solution, here you go :

    With iOS7, you can use this approach to show/hide your toolbar button :

        if(// your code Condition) 
    { self.toolbarBtn1.enabled = YES;
     self.toolbarBtn1.tintColor = nil; }
     else
     { self.toolbarBtn1.enabled = NO; 
    self.toolbarBtn1.tintColor = [UIColor clearColor]; }
    

提交回复
热议问题