查询2个数字和2个不同的字段?

时间:2013-09-18 12:22:22

标签: ios objective-c parse-platform

我在Parse.com上有一个类,它有一个x和y字段。是否可以使用一个查询来获取x = 10x = 20以及y = 10y = 20中所说的所有对象?

查询是否会像这样设置?

    PFQuery *query1 = [PFQuery queryWithClassName:@"myClass"];
    [query1 whereKey:@"x" greaterThanOrEqualTo:[NSNumber numberWithInt:leftEdge]];
    [query1 whereKey:@"x" lessThanOrEqualTo:[NSNumber numberWithInt:rightEdge]];


    PFQuery *query2 = [PFQuery queryWithClassName:@"myClass"];
    [query1 whereKey:@"y" greaterThanOrEqualTo:[NSNumber numberWithInt:topEdge]];
    [query1 whereKey:@"y" lessThanOrEqualTo:[NSNumber numberWithInt:bottomEdge]];


    PFQuery *query = [PFQuery orQueryWithSubqueries:@[query1, query2]];

0 个答案:

没有答案