Objective-C是否支持C#样式属性? [英] Does Objective-C support C# style attributes?

查看:96
本文介绍了Objective-C是否支持C#样式属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Objective-C是否支持使用属性标记属性/方法?像这样:

Does Objective-C support marking properties/methods with attributes? like so:

#MyAttribute //sudo example
@porperty (nonatomic, retain) NSString * myString;

然后,我想反射"该类,并确定将什么属性附加到属性"myString".

I would then like to "reflect" over the class and determine what attribute is attached to the property "myString".

这样可能吗?

谢谢

推荐答案

不,Objective-C中没有属性.您确实获得了一种反射形式,可以测试实例以查看实例中是否存在该实例,但这就是您所得到的全部.

No, there are no attributes in Objective-C. You do get a form of reflection, you can test an instance to see if it exists in the instance, but that is all you get.

这篇关于Objective-C是否支持C#样式属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆