ではオフになっていますUILabelは、私はに走った問題を実証するサンプルアプリケーションされています。ここではバグ? UITextFieldDelegateによるライブ更新は1つの文字ここ
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var aTextField: UITextField!
@IBOutlet weak var aTextLbl: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
aTextField.delegate = self
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
aTextLbl.text = aTextField.text
return true
}
}
はデモです:
私の質問をされますどのようにラベルをテキストフィールドに入力したものと正確に同期させるようにするのですか?ありがとう!
を参照してください。例えばhttps://stackoverflow.com/questions/28394933/how-do-i-check-when-a-uitextfield-changes。 –