开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜