简体   繁体   中英

Get an ivar or property from a NSString

Can we get an ivar 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM