我使用以下代码获取最大值:
NSArray *allValues = @[ [NSNumber numberWithInt:20],
[NSNumber numberWithInt:36],
[NSNumber numberWithInt:84],
[NSNumber numberWithInt:11],
[NSNumber numberWithInt:28]];
int max = [[allValues valueForKeyPath"@max.intValue"] intValue];
int min = [[allValues valueForKeyPath"@min.intValue"] intValue];
但我有一个问题,什么文件可以告诉我 KeyPath 链接在哪里 @max.intValue
或@min.intValue.如果我知道我可以知道的关键路径做其他效果
Best Answer-推荐答案 strong>
您可以在 Key-Value Coding Programming Guide 中找到此信息:
@max
The @max operator compares the values of the property specified
by the key path to the right of the operator and returns the maximum
value found. The maximum value is determined using the compare: method
of the objects at the specified key path. The compared property
objects must support comparison with each other. If the value of the
right side of the key path is nil, it is ignored.
@min
The @min operator compares the values of the property specified
by the key path to the right of the operator and returns the minimum
value found. The minimum value is determined using the compare: method
of the objects at the specified key path. The compared property
objects must support comparison with each other. If the value of the
right side of the key path is nil, it is ignored.
关于iphone - 在哪里可以找到 @max.intValue,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/15611271/
|