Swift:在自动对焦时创建的搜索栏 [英] Swift: Search bar created at Auto Focus
本文介绍了Swift:在自动对焦时创建的搜索栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在通过单击按钮创建表格视图和搜索栏.但我需要搜索栏出现在自动聚焦处(用户无需在搜索栏中单击即可立即输入文本).我该怎么做?
I am creating a table view and a search bar by clicking on a button.But I need the search bar to appear at Auto Focus ( where the user enters text immediately with no need to click inside the search bar). How can I do that ?
推荐答案
试试这个
@IBOutlet weak var searchBar: UISearchBar!
override func viewDidLoad()
{
super.viewDidLoad()
searchBar.becomeFirstResponder()
}
这篇关于Swift:在自动对焦时创建的搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文