0

In my iphone app i have a search screen with UISearchDisplaycontroller uisng this against each scopeBar key words we can filter the search result, But using only this scopeBar buttons i couldnt reach my requirement.

See, I have a list of members, I need to search members based on state, country, city, name. and i should display these search types in a bar (say scopBar).

After selecting a scopeBar button(say Country)if we type 'India' in the search bar it should display all the members of that country. How can i achieve these kind of search ? I have tried many search tutorials, But those didnt help me. Please help me out.

Thanks in Advanced!

Ravi
  • 1,759
  • 5
  • 20
  • 38
  • It would help to know how your original data is stored and in what format it is held in your code. For example, are you pulling the info from a SQLite database or a simple CSV file? Is the data stored as NSDictionary or NSArray? – Aaron Hayman Jul 20 '12 at 12:19

2 Answers2

1

As per Apple's Sample code, we can use 2 arrays during search, 1 actual, and 2nd is filtered array as in example reference :

http://developer.apple.com/library/ios/#samplecode/TableSearch/Listings/MainViewController_m.html#//apple_ref/doc/uid/DTS40007848-MainViewController_m-DontLinkElementID_6

But in your case, we are requiring 3 arrays, third array will be local array (let's call scopedFilteredArray) during filteration.

  1. Search all objects by scope bar : Using Predicate (contained by scopedFilteredArray, from actual array).

  2. Search filtered objects from scopedFilteredArray and save them in filteredArray for display.

Ankit Thakur
  • 4,739
  • 1
  • 19
  • 35
0

Have a modal window appear to select your extra filter parameters (put whatever control you want there), and create a global search nsmutabledictionary to store your parameters.

I put it to appear on the book (bookmarks) button (it passed apple checks), for easy access.

Panagiotis
  • 1,539
  • 1
  • 14
  • 28