开发者

How to refer each UIButton

开发者 https://www.devze.com 2022-12-15 08:44 出处:网络
I add 10 buttons to UIScrollView for开发者_Python百科 (int i=0; i<10; i++) { UIButton *btn =....

I add 10 buttons to UIScrollView

for开发者_Python百科 (int i=0; i<10; i++) {

     UIButton *btn =  ....  

     [ScrollView addSubview:btn];

}

How can i refer to each button ?


btn.tag = i;

and later,

[scrollView viewWithTag: 2];


Either set the tag on each view, and find them using viewWithTag, or save references to each in an NSMutableArray or other data structure.

0

精彩评论

暂无评论...
验证码 换一张
取 消