Reputation: 59
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.
Upvotes: 0
Views: 575
Reputation: 236260
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
}
}
Upvotes: 4