Button with Tag

前端 未结 2 1908
醉话见心
醉话见心 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:31
    UIButton *button=(UIButton *)[self.view viewWithTag:tag];
    button.alpha=0.5;
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题