我目前正在使用 Swift 编写一个 iOS 应用程序,并且我有一个带有 UITextField 的 View Controller ,我已将键盘上的返回按钮更改为“搜索”按钮,如何使该按钮启动一个新的带有segue的 View Controller ?我尝试通过键盘使用委托(delegate),但是当我单击它时,打开 Controller 两次并且转场不起作用。
注意:我使用的是导航 Controller
最佳答案
使用 UITextField delegate :
func textFieldShouldReturn(textField: UITextField) -> Bool
{
// segue code here
return super.textFieldShouldReturn(textField)
}
关于ios - 使用 Swift 在键盘上启动一个带有搜索按钮的新 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37120874/