开发者

How to refer each UIButton

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜