开发者

objective-c: access outlet with string containing its name

开发者 https://www.devze.com 2023-02-10 07:58 出处:网络
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:

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

精彩评论

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

关注公众号