检查UITextField中的更改 [英] Check for changes in UITextField
本文介绍了检查UITextField中的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试制作一个应用程序,用于检查UITextField中的文本并执行某些操作以响应其中的内容。我可以让用户输入他们的输入然后按一个按钮。我希望能够在不使应用程序无响应的情况下持续检查文本字段。
I'm attempting to make an app that checks the text in a UITextField and does something in response to what is written in it. I could possibly have the user type their input and then press a button. I want to be able to check the text field constantly without the application becoming unresponsive.
推荐答案
您需要做的就是附加您的UITextField已发送事件的IBAction已更改编辑:
What you have to do is to attach an IBAction to your UITextField Sent Events Editing Changed:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var strLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func editingChanged(sender: UITextField) {
strLabel.text = sender.text
}
}
这篇关于检查UITextField中的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文