Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nekbeth

macrumors regular
Original poster
Feb 20, 2011
101
0
Vatican City
Hi, I'm trying to add a SearchBar to an Array of Dictionaries. I'm following a tutorial from the book "Beginning iPhone SDK" , in which case uses a .plist of a Dictionary of Arrays. I tried to use the same logic from that example. You can see the .plist photos of both cases after the code. Any kind of advice will be much appreciated, let me know if you need more code about the variables. Thank you

Here is the way the book copies all the movies in the dictionary into the list of Movies array:
Code:
listOfMovies = [[NSMutableArray alloc] init]; 
for (NSString *year in array)     //---get all the years---      

{
   //---get all the movies for a particular year---
   NSArray *movies = [movieTitles objectForKey:year]; 
   for (NSString *title in movies)

  {

    [listOfMovies addObject:title];

  }

}

I'm trying to copy all my recipes of the array to a List of Recipes array: (here is what I got so far, I'm not sure i'm copying the right way)

Code:
listOfRecipes = [[NSMutableArray alloc] init]; 
 for (NSString *????)                                 //Here is where I get lost, RecipesData represents my Data Source

    {

        {
 

Attachments

  • Movies.jpg
    Movies.jpg
    71.1 KB · Views: 112
  • Recipes.jpg
    Recipes.jpg
    52.8 KB · Views: 94
Ok, I 've try some write some code by my own in order to add the Titles of my recipes to the NSMutable Array "ListOfRecipes. Xcode doesn't show me any errors or warnings , Is this OK ?

Code:
//---copy all the recipes titles in the Array INTO the listOfRecipes Array--- 
    listOfRecipes = [[NSMutableArray alloc]init];
    
    //Obtaining the Data Source from the Main Array
    NSDictionary *array = [ self.RecipesData  valueForKey:@"Rows"];
    
    //Get the Titles of the Dictionaries.
    NSArray *Children = [array objectForKey:@"Title"];
    
    Children = listOfRecipes;
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.