简体   繁体   English

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

[英]filter an NSArray, which contains NSDictionary within NSDictionary

I am trying to filter a NSArray which contains objects which are NSDictionary . 我正在尝试过滤包含NSDictionary对象的NSArray This NSDictionary again contains NSDictionary inside it. NSDictionary再次在其中包含NSDictionary

It looks something like this. 看起来像这样。

[
  {
    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;
    };
  }
]

I want to filter this Array to some "text" which matches with object for "Comp_Name". 我想将此数组过滤为与“ Comp_Name”的对象匹配的“文本”。

Code that I am using is: 我正在使用的代码是:

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

Please help me getting a filtered list based on object "Comp_Name", "text". 请帮助我获取基于对象“ Comp_Name”,“ text”的过滤列表。

@rmaddy - Thanks for help!!! @rmaddy-感谢您的帮助!!! @"Comp_Name.text == %@" works just fine. @"Comp_Name.text == %@"可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM