title: Using NSPredicate in 2D Arrays
body: <p>This question is based off of the same app/source from my previous question which can be found here:</p>
  
  <p><a href="https://stackoverflow.com/questions/4552783/how-to-manage-memory-using-classes-in-objective-c">How to manage memory using classes in Objective-C?</a></p>
  
  <p>I have a nested array which looks something like this when printed out (I only copied and pasted a brief part of it).</p>
  
  <pre><code>(
          (
          &lt;Term: 0x4256420&gt;,
          &lt;Term: 0x420fa40&gt;,
          &lt;Term: 0x4257bd0&gt;,
          &lt;Term: 0x4257cf0&gt;,
          &lt;Term: 0x4257d90&gt;,
          &lt;Term: 0x4257e30&gt;
      ),
          (
          &lt;Term: 0x4257e50&gt;,
          &lt;Term: 0x4257f90&gt;,
          &lt;Term: 0x4257fb0&gt;,
          &lt;Term: 0x42580e0&gt;,
          &lt;Term: 0x4258170&gt;,
          &lt;Term: 0x4258210&gt;,
          &lt;Term: 0x4258230&gt;,
          &lt;Term: 0x4258360&gt;,
          &lt;Term: 0x4258400&gt;,
          &lt;Term: 0x42584a0&gt;,
          &lt;Term: 0x4258540&gt;,
          &lt;Term: 0x42585e0&gt;,
          &lt;Term: 0x4258670&gt;,
          &lt;Term: 0x4258710&gt;
      ),
  </code></pre>
  
  <p>And here is my code for the search part of my table:</p>
  
  <pre><code>- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section 
  {
      // Normal table
      if (aTableView == self.tableView) return [[self.sectionArray objectAtIndex:section] count];
  
      // Search table
      //NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name contains[cd] %@", self.searchBar.text];
      //self.filteredArray = [self.crayonColors filteredArrayUsingPredicate:predicate];
   NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name contains[cd] %@", self.searchBar.text];
      self.filteredArray = [[self.sectionArray objectAtIndex:section] filteredArrayUsingPredicate:predicate];
  
  
      return self.filteredArray.count;
  }
  </code></pre>
  
  <p>I am getting the error that I cannot allocate enough room which means that I must be doing something wrong, I just cannot figure out what.</p>
  
  <p>The commented out portion of the search part in the above method works but crayonColors is just a simple NSMutableDictionary of NSStrings and does not have arrays nested inside of it.</p>
  
  <p>Thanks in advance!</p>