(Note: This is an extension of a previous question.)
I am having some difficulty implementing a SearchBar for fairly complex tableview. The tableView has multiple sections, two lines of text and an image. All the data is loaded from a plist and then put into sections by the initial letter of the value for the "Name" key. NSLog returns the following for my main dictionary "sectionedDictionaryByFirstLetter":
sectionedDictionaryByFirstLetter:{
B = (
{
Name = "B...A Name Starting with B";
Image = "ImageName1.png";
Text = "Some Text";
}
);
C = (
{
Name = "C...A Name Starting with C";
Image = "ImageName2.png";
Text = "Some Text";
}
);
N = (
{
Name = "N1...A Name Starting with N";
Image = "ImageName3.png";
Text = "Some Text";
},
{
Name = "N2...A Name Starting with N";
Image = "ImageName4.png";
Text = "Some Text";
},
{
Name = "N3...A Name Starting with N";
Image = "ImageName5.png";
Text = "Some Text";
}
);
}
I want to filter the sub dictionaries by the value for the "Name" key. Can anyone recommend either how to go about this or some resources for learning how? I've been following the example in "Beginning iPhone 3 Development" but haven't been able to translate it to my situation. So if a user types "with N" in the search bar, I would like the new dictionary to appear as:
filteredSectionedDictionaryByFirstLetter:{
N = (
{
Name = "N1...A Name Starting with N";
Image = "ImageName3.png";
Text = "Some Text";
},
{
Name = "N2...A Name Starting with N";
Image = "ImageName4.png";
Text = "Some Text";
},
{
Name = "N3...A Name Starting with N";
Image = "ImageName5.png";
Text = "Some Text";
}
);
}
Just to clarify, I have my searchBar installed in the view, I'm just having trouble making it functional. I'm currently toying with a custom method called - (void)handleSearchForTerm:(NSString *)searchTerm from the example in the book.
Thanks for the help!