OStack程序员社区-中国程序员成长平台

标题: iphone - 在哪里可以找到 @max.intValue [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 01:45
标题: iphone - 在哪里可以找到 @max.intValue

我使用以下代码获取最大值:

 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-推荐答案


您可以在 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/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4