Get an ivar or property from a NSString
Can we get an iva开发者_开发技巧r
or a property
from a NSString
like we can get a class
from a NSString
with the function NSClassFromNSString()
?
For any properties you can just use [object valueForKey:myString]
and it'll be done. This can also find ivars in certain situations.
There are a number of functions in the Objective-C Runtime that let you get the list of ivars, properties, and methods associated with a given class, and then to get information about individual ivars, properties, and methods. Take a look at the Objective-C Runtime Reference.
精彩评论