Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loop through similarly-named Controls

I have view0 through view25. I don't particularly want to have a 25-case switch, so is there a way to do something like this?

- (void)modifyViewNumber:(int)number
{
     [view*number* dosomething];
}
like image 718
Walker Avatar asked Jan 21 '26 04:01

Walker


2 Answers

Put the views in an array at startup.

like image 91
Marco Mustapic Avatar answered Jan 23 '26 07:01

Marco Mustapic


You could put a tag on each view and use a for loop with the following method:

- (id)viewWithTag:(NSInteger)aTag
like image 37
Lounges Avatar answered Jan 23 '26 08:01

Lounges