how can i get object from tag?

后端 未结 2 1290
自闭症患者
自闭症患者 2021-02-10 09:53

i have one view .in that view i have 2 buttons .

i know tag of that button . i want to change image of that button.

how can i change image by this tag?

相关标签:
2条回答
  • 2021-02-10 10:36
    UIScrollView * scView=(UIScrollView*)[self.view viewWithTag:20];
    UIButton *button = (UIButton *)[scView viewWithTag:3];
    
    0 讨论(0)
  • 2021-02-10 10:41
    UIButton *button = (UIButton *)[myView viewWithTag:myTag];
    [button setImage:... forState:...];
    
    0 讨论(0)
提交回复
热议问题