Button with Tag

前端 未结 2 1930
醉话见心
醉话见心 2021-01-16 12:21

How do I get a button with the a specifyed tag

id like to then cast it to a UIButton, and change the alpha

2条回答
  •  没有蜡笔的小新
    2021-01-16 12:33

     UIView* view = [theViewContainingThatButton viewWithTag:tag];
     view.alpha = 0.5;
    

    You don't need to cast the view to a UIButton to change its alpha. But you can add a (UIButton*) cast if really needed.

提交回复
热议问题