过滤NSArray,其中包含NSDictionary中的NSDictionary

时间:2012-10-11 17:04:51

标签: objective-c ios nsarray nsdictionary

我正在尝试过滤包含NSArray对象的NSDictionary。此NSDictionary在其中再次包含NSDictionary

它看起来像这样。

[
  {
    Comp_Name =      {
        text = "Quality Ace #5846-C";
    };
    ShipTo =         {
        text = 312025846;
    };
    SoldTo =         {
        text = 10000081;
    };
  },
  {
    Comp_Name =      {
        text = "Billington Ace Hardware  - 5863K";
    };
    ShipTo =         {
        text = 312025863;
    };
    SoldTo =         {
        text = 10000081;
    };
  }
]

我想将此数组过滤为与“Comp_Name”对象匹配的“text”。

我正在使用的代码是:

_filteredList = [_unFilteredArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"Comp_Name == %@", searchBar.text]];

请帮我根据对象“Comp_Name”,“text”获取筛选列表。

1 个答案:

答案 0 :(得分:0)

@rmaddy-感谢您的帮助!!! @"Comp_Name.text == %@"工作正常。