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.
精彩评论