How can I force the UISearchBar to automatically start a new search (like pressing the Search button)? Is there an easy way to achieve this?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
Yes you only need to make an implicit call to the
searchBarSearchButtonClicked:
on yourUISearchbarDelegate
. Have a look to the official doc for more info about this delegate.I can not get the delegate object but the searchBar itself, this code can work.
I found that I needed to set the UISearchViewController to active before changing the value of the search field programatically to make UISearchViewController automatically perform the search:
Swift 4
You can force your searchBar,
Objective C:
Swift 3.0:
This will trigger your searchBar.
Just have the search input field become the first responder:
seems dumb, but works, so it's not dumb ;)