UA-17470720-3

Jump to content


Photo
- - - - -

UISearchBar Search Button


  • Please log in to reply
6 replies to this topic

#1 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 24 November 2010 - 11:19 PM

Hi,

I've attempted to have my delegate respond to searchBarSearchButtonclicked, but it's not working.

It's probably because when I set the searchBar property of my tableModel to my searchBar outlet, STV is taking over delegate duties.

So that begs the question: How do you react to the Search button? I have the type-ahead working and the Cancel button works, but the Search button does nothing. Since the type-ahead has effectively already searched and hopefully found what you're looking for, the Search button should basically just resignFirstResponder and put the keyboard away. This is especially important if there are a lot of search results and you don't want to have to scroll through your table with the keyboard showing.

Further to that, is it possible to use the UISearchBarDisplayController instead of just a UISearchBar? I'd like to provide the same kind of type-ahead searching as done in the Contact app. In that case, the UINavigationBar is pushed up out of the way and the search bar goes in its place until you dismiss the keyboard.

I tried wiring up my SCTableViewModel to the UISearchBarDisplayController's searchBar instance, but SCT didn't pick up on that.

Thanks,

Brendan

#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 25 November 2010 - 07:06 AM

Hi Brendan,

We've actually added all these UISearchBar delegate methods under the SCTableViewModelDelegate protocol. I'll send you our latest update now.

Regarding your UISearchBarDisplayController, is it just the navigation bar disappearing effect that you require?

#3 Bill Wernet

Bill Wernet

    Starting Out

  • STV 3.0 Pro
  • Pip
  • 9 posts
Reputation: 0
Neutral

Posted 25 November 2010 - 11:39 AM

tarek,

I also could use that update.

Thanks,

Bill

#4 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 25 November 2010 - 11:45 AM

Hello Tarek,

The update worked great. Thanks!

There are two aspects to the UISearchDisplayComponent that I need. Yes, one is the hiding of the navigation bar. The other is the ability to perform asynchronous searches as the user types. I need to search an online database of over 80,000 manufacturers. It's too much data to download to do in-memory filtering, so I'm going to try to implement searching against our web service asynchronously. USearchDisplayDelegate provides a method searchDisplayController:shouldReloadTableForSearchString: which I believe is where you would kick off an asynchronous search. Then update the table view in the search results.

Is there a way to accomplish the same thing with STV? I won't be loading in all 80,000 manufacturers to search through in memory.

Thanks,

Brendan

#5 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 25 November 2010 - 03:30 PM

We're currently implementing a delegate that will enable you to provide your own custom results as the user types in their search (as an NSArray of strings). Does this fully satisfy your requirements?

#6 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 25 November 2010 - 03:38 PM

The results would have to be an NSArray of NSString? I will need to be able to get an NSArray of NSObject. Since in my situation I'm fetching Manufacturer objects which have a name, an ID and a logo URL. Basically when I fetch from my web service, I get a plist which I decode and then marshal into an NSArray of STIManufacturer objects. So from that point on I'm dealing with an STIManufacturer entity object.

Thanks,

Brendan

#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 25 November 2010 - 03:46 PM

Apologies Brendan, it's an NSArray of NSObjects. Time for my coffee break :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users