I have an NSArray
with custom class objects having a NSNumber
property. I am trying to fetch a minimum & maximum values from the array. So this is my code:
MyClass *minObj = [filteredArray valueForKeyPath:@"@min.self.height"];
MyClass *maxObj = [filteredArray valueForKeyPath:@"@max.self.height"];
This works and I could get a min and max values but is of NSNumber
type. So minObj
and maxObj
will be of a number and not of MyClass
type.
Is there a good way to find out the same and get the MyClass
instead of NSNumber
?
P.S. There can be more than one same values which can be minimum or maximum.