How can I dynamically hide a button from a view?

前端 未结 12 2120
执念已碎
执念已碎 2020-12-04 21:24

I would like to dynamically hide a button in one of my views depending on a certain condition.

I tried adding some code to the view controller\'s -viewWillAppe

12条回答
  •  渐次进展
    2020-12-04 22:18

    This is what I did for button items that weren't part of the navigation bar (where Blank.png is a blank image I created that's the same size of the image it replaces):

    theButton.enabled = NO;
    theButton.image = [UIImage imageNamed: @"Blank.png"];
    

提交回复
热议问题