Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. arrTripCat :
  2. (
  3. { tripcategory = "general_tourism"; },
  4. { tripcategory = nightlife; },
  5. { tripcategory = "art_museums"; },
  6. { tripcategory = nightlife; },
  7. { tripcategory = architecture; },
  8. { tripcategory = nightlife; }
  9. );
  10.  
  11. NSArray *arrTripCat = [NSArray arrayWithArray:[self.dictSearchResult objectForKey:@"TripCategories"]];
  12.  
  13. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY SELF.@allKeys contains[cd] %@",@"tripcategory"];
  14.  
  15. NSMutableArray *filteredArray = [[NSMutableArray alloc] init];
  16. [filteredArray addObjectsFromArray:[arrTripCat filteredArrayUsingPredicate:predicate]];
  17.  
  18. filteredArray:
  19. (
  20. { tripcategory = "general_tourism"; },
  21. { tripcategory = nightlife; },
  22. { tripcategory = "art_museums"; },
  23. { tripcategory = nightlife; },
  24. { tripcategory = architecture; },
  25. { tripcategory = nightlife; }
  26. );
  27.  
  28. ( general_tourism, nightlife, art_museums, architecture )
  29.  
  30. NSArray *tripCategories = [arrTripCat valueForKey:@"tripcategory"];
  31.  
  32. NSMutableArray *results = @[].mutableCopy;
  33. for (NSDictionary *dict in arrTripCat) {
  34. [results addObject:dict[@"tripcategory"];
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement