开发者

Get an ivar or property from a NSString

开发者 https://www.devze.com 2023-03-11 04:48 出处:网络
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

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.

0

精彩评论

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