0

ios searchbar option

Hi everybody, does anyone know what the [a...] button function inside the searchbar is called within iOS?

I am looking for a tutorial on how to do this kind of function but already have difficulty naming the function itself to look for it.

Thank you very much!

baik
  • 993
  • 2
  • 14
  • 21
  • 2
    what does it do? I'm very sure this is costum work. Either you do a subclass of the UISearchBar or you try to insert a button(don't know if it's possible. – arnoapp Sep 24 '12 at 20:55
  • It changes the behavior of the search query, i.e. performs LIKE "a%" or LIKE "%a". – baik Sep 24 '12 at 21:37
  • 3
    Okay it's definitely costume. I think you need to create a costume UISearchBar with a Button inside or you try to lay the button over it. I'm sure there a several ways but unfortunately I'm not familiar with it. I hope someone will help you ;) – arnoapp Sep 24 '12 at 21:44
  • Take a look at http://stackoverflow.com/questions/1200149/styling-the-cancel-button-in-a-uisearchbar – Parag Bafna Sep 29 '12 at 14:05

2 Answers2

2

This appears to be a custom search UI.

I would call it a wildcard search. Could also be referred to as "beginsWith" for the shown example, or "endsWith" for a different type of search.

For the search logic: http://www.cocoanetics.com/2010/03/filtering-fun-with-predicates/

And for the UI: http://developer.apple.com/library/ios/#documentation/uikit/reference/UISearchBar_Class/Reference/Reference.html

Nicolas Renold
  • 557
  • 2
  • 5
  • Thank you very much for those links. Could you describe or hint at how to build a subclass for the UI to accomodate buttons inside the search field? This seems quite hard to derive from just the UI reference. – baik Sep 28 '12 at 06:28
  • Maybe you can look here for some inspiration: https://github.com/thermogl/TITokenField – Nicolas Renold Oct 10 '12 at 21:16
0

Unfortunately, the iOS SDK does not include a prebuilt way of doing this, so you will have to build a custom control. Use UITextField as the base and add your button as the leftView.

Check out this question: Adding subviews to UITextField leftView property

I hope this helps.

Community
  • 1
  • 1
FD_
  • 12,947
  • 4
  • 35
  • 62