Dev
Dev

Reputation: 161

How to develop iOS app just like AppStore's searching function?

I want to develop a simple dictionary application which is like the Search tab of AppStore on iPhone:

  1. The 1st screen have a SeachBar on top, the bottom is "History words" (such as "Trending Searches" on AppStore).

enter image description hereenter image description here

When user touches the SearchBar, the bottom view is gray. Touching the gray area to leave the Seach text-box and my user is able to click on one of history words.

  1. If he/she types on SearchBar, the suggestion words list appears and he/she can click a word to see its definition with the SearchBar containing the word there (I don't want my users having to go to 2nd view to see word's definition because if so, they must click Back button to touch and type on Seach text-box. It's likely that, my application has only 1 ViewController).

enter image description hereenter image description here

I know how to work with SearchBar and TableView to display the suggestion words list but don't know what to do to implement other things:

Thanks for reading and please show me some keywords, clues to solve three issues above.

Many thanks!

Upvotes: 1

Views: 937

Answers (1)

Candost
Candost

Reputation: 1029

Use UISearchController to create a page like you wanted.

It has dimsBackgroundDuringPresentation property to make a backgroundView gray when user is typing.

It has - (instancetype)initWithSearchResultsController:(UIViewController *)searchResultsController method. You can initialize the UISearchController with resultsController. For results you can do whatever you want.

Lastly, you can set a custom view to see "History words" to UISearchController

Upvotes: 1

Related Questions