Set Objective-C property by string

后端 未结 1 1089

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)
提交回复
热议问题