objective-c: access outlet with string containing its name
I have IBOutlets named for example: outlet1, outlet2, outlet3. I want to access this outlets using @"outlet%d" where %d is value of variabl开发者_开发百科e. Is it possible?
Did you try:
[myClass valueForKey:[NSString stringWithFormat:@"outlet%d", i]];
Have a look at the Key Value Programming Guide
精彩评论