开发者

Possible to get a constants value with string?

Is there a way to get a constants value by using a string for its name similar to KVC i.e:

#define kStringConstTest = @"test";

get the value of this const by knowing that the firs开发者_JAVA技巧t part is always kStringConst and appending a dynamic second part like @"Test" to it to get its value?

thx


No, this is not possible. (I wish it were; it would make everyone's lives easier.) The alternative is to create a method that takes that dynamic string and determines the string to return using a bunch of if/else statements.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜