Set Objective-C property by string

后端 未结 1 1091

I\'m wondering if there\'s an easy way to set (or retrieve) an Objective-C property by a NSString... It is possible to use NSSelectorFromString, but I\'d like a

相关标签:
1条回答
  • 2020-12-18 19:48

    Use Key-Value Coding. Your example would be [object setValue:@"propertyValue" forKey:@"propertyName"].

    0 讨论(0)
提交回复
热议问题