Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 检查UITextField中的更改_Ios_Swift_Uitextfield - Fatal编程技术网

Ios 检查UITextField中的更改

Ios 检查UITextField中的更改,ios,swift,uitextfield,Ios,Swift,Uitextfield,我正在尝试制作一个应用程序,用于检查UITextField中的文本,并对其中写入的内容做出响应。我可以让用户键入他们的输入,然后按下按钮。我希望能够在应用程序没有响应的情况下不断检查文本字段。您需要做的是将iAction附加到UITextField发送事件编辑更改: import UIKit class ViewController: UIViewController { @IBOutlet weak var strLabel: UILabel! override func

我正在尝试制作一个应用程序,用于检查UITextField中的文本,并对其中写入的内容做出响应。我可以让用户键入他们的输入,然后按下按钮。我希望能够在应用程序没有响应的情况下不断检查文本字段。

您需要做的是将iAction附加到UITextField发送事件编辑更改:

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
    }
}


您需要做的是将iAction附加到UITextField发送的事件编辑更改:

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
    }
}


UITextLabel??你的意思是UILabel还是UIExtField?我同意@rdelmar,这个问题不清楚。UIExtLabel??你是指UILabel还是UITextField?我同意@rdelmar,这个问题不清楚。