【发布时间】:2011-07-22 06:01:38
【问题描述】:
假设我有 2 个 Person 类实例。一个叫约翰,一个叫玛丽。 Person 类有两个属性 age 和 gender。有没有办法通过所有实例的属性进行迭代并检查当前属性是否等于给定属性?像这样的:
for (iterate thorough all properties of instance mary) {
//first iteration
@selector(mary.age)==@selector(john.age) //this would be YES;
//second iteration
@selector(mary.gender)==@selector(john.age) //this would be NO;
}
【问题讨论】:
-
所以第一个问题是如何遍历对象的属性:)
标签: iphone objective-c ipad macos