You have set the getter method to toString
, so
[instanceOfValueClass valueForKey:@"toString"]
should work. Note that you don't have to "rename" the getter method, you could just override the default getter:
@property(nonatomic,readonly) NSString *stringVal;
- (NSString *)stringVal
{
NSString *s = ...; // compute property value
return s;
}
Then both instance.stringVal
and [instance valueForKey:@"stringVal"]
would work, with the "same key".