Reputation: 4235
i've got some code:
int k = 0;
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
label = [[UILabel alloc] initWithFrame:CGRectMake(30*i, 30*j, 30, 30)];
[label setText:[NSString stringWithFormat:@"%d", filterTab[i][j]]];
[label setTextAlignment:UITextAlignmentCenter];
[label setFont:[UIFont systemFontOfSize:15]];
[label setTextColor:[UIColor grayColor]];
[label setBackgroundColor:[UIColor clearColor]];
[label setTag:k];
[array addObject:label];
[tableFilter addSubview:label];
k++;
}
}
so, this create 81 labels and add all to view and to array and i've got button: DO SOMETHING and this button have action. this action must change text in selected label with tag = 80.
how can i do this?
Upvotes: 0
Views: 196
Reputation: 141869
You can pull the UILabel
view directly from the tableFilter
view without using the array you've created as,
UILabel *label = (UILabel *)[tableFilter viewWithTag:80];
label.text = @"Foo";
Upvotes: 1