0

I want a button action that will change the button title but also will change other buttons title, I don't know how to refer those buttons (I have 9 (3X3) buttons).

Is there anyway i can refer those by their tags?

4

1 回答 1

1

您可以为这些按钮创建一个出口,或者通过它们的标签值获取它们:

UIButton *myButton = (UIButton *)[self.view viewWithTag:TAG_VALUE];
[myButton setTitle:@"New Title" forState:UIControlStateNormal];

首选的 iOS 方式是使用 outlet,但您也可以使用您正在抓取的视图的标签值。

于 2012-06-22T17:42:12.313 回答