2014-01-13 48 views
5

我想對多個條件的pfquery進行排序,下面的代碼只排序一列。請幫忙。對iOS7的多個條件的pfquery的排序

- (PFQuery *)queryForTable 
{ 
    PFQuery *query = [PFQuery queryWithClassName:self.parseClassName]; 
    [query whereKey:@"mStatus" equalTo:@"running"]; 
    [query orderByAscending:@"mName"]; 
    [query orderByAscending:@"mOrder"]; 
    return query; 
} 

回答

12
- (PFQuery *)queryForTable { 
    PFQuery *query = [PFQuery queryWithClassName:self.parseClassName]; 
    [query whereKey:@"mStatus" equalTo:@"running"]; 
    [query orderByAscending:@"mName"]; 
    [query addAscendingOrder:@"mOrder"]; 
    return query; 
} 
+0

工作就像一個魅力,謝謝 – mugunthan

+1

將上面的代碼有排序的順序?像mName將優先考慮,訂單將優先考慮? –

+0

@ImranAhmed是的 – jonahb