I have a Cocoa-Application in which I have a NSMutableArray which contains instances of an NSImageView subclass.
What I am trying to do is to get the minimum value for the x value of the ImageViews bounds origin.
I have tried:
double minx =[[robots valueForKeyPath:@"@min.bounds.origin.x"] doubleValue];
as well as:
double minx =[[robots valueForKeyPath:@"@min.self.bounds.origin.x"] doubleValue];
However I get the following error:
[<NSConcreteValue 0x100597a20> valueForUndefinedKey:]: this class is not key value coding-compliant for the key origin.
I have searched the internet and the NSKeyValueCoding Protocol Reference, but I didn’t find a solution for my problem. I know that I could just loop through the NSMutableArray, but using valueForKeyPath would be the better way I guess.
The error is because
NSRect(the returned value from[NSImageView bounds]) is a simplestructand not an Objective-C object.I would recommend subclassing
NSImageViewand exposing those values as properties so that they are Key Value Coding-Compliant.