Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-23-2009, 04:48 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 3
Default Filtering a dictionary by the value for a key in the sub dictionaries with a UISearch

This question has been posted on StackOverflow for over a week and I'm still looking for an answer. I thought perhaps some of the folks over here might be able to help!

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)handleSearchForTermNSString *)searchTerm from the example in the book.

Thanks for the help!
jonah is offline   Reply With Quote
Reply

Bookmarks

Tags
filter, iphone, nsarray, nsdictionary, uisearchbar

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 292
20 members and 272 guests
14DEV, ADY, Bertrand21, Dani77, HemiMG, iDifferent, IphoneSdk, jakerocheleau, JasonR, jimbo, macquitzon216, MACralik, NSeven, prchn4christ, Rudy, silverwiz, spiderguy84, Sunny46
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:59 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0