How to disable UIBarButtonItem?

后端 未结 4 2043
清酒与你
清酒与你 2020-12-30 18:53

I have a UIBarButtonItem that just doesn\'t want to get disabled. Short version: when I call

[myBarButtonItem setEnabled:NO];

Nothing happe

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-30 19:38

    In my case (Swift) I had 2 barButtonItems added as an array - so to disable them this did the trick

        navigationItem.rightBarButtonItems?.first?.enabled = false
        navigationItem.rightBarButtonItems?.last?.enabled = false
    

提交回复
热议问题