Swift UI special training 17 SearchBar search entries, uisearchbar
The search bar is a simple operation in the UI. Drag a search bar.
The most important attribute in the search bar is the Placeholder, that is, the Placeholder on the right side of the graph. For example, if you enter "enter a keyword", It is shown as follows:
Set the background color:
The Options Option will make some adjustments to the search box:
For example, if we select the first item, a drop-down arrow is displayed:
Next, let's look at this part:
There are some interesting options, such as the Keyboard Type. When we enter Chinese characters and numbers on the webpage, we can only enter numbers when entering phone numbers, this option is used.
There is also the Return Key, we can open it to see:
This includes many frequently used search websites.
To perform some operations on the searched items, you only need to implement the callback method UISearchBarDelegate.