Denis Mikhaylov
Denis Mikhaylov

Reputation: 2045

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 variable. Is it possible?

Upvotes: 0

Views: 238

Answers (1)

Abizern
Abizern

Reputation: 150615

Did you try:

[myClass valueForKey:[NSString stringWithFormat:@"outlet%d", i]];

Have a look at the Key Value Programming Guide

Upvotes: 1

Related Questions