ios – UITextField not calling editingChanged on system however works on simulator

[ad_1]

I’ve a UITextField units up in UICollectionViewCell. I’ve used closure to declare the UITextField as follows:

var nameTextField: UITextField = {
    let textfield = UITextField()
    textfield.backgroundColor = .clear
    textfield.borderStyle = .line
    textfield.placeholder = "Identify"
    textfield.textColor = UIColor.white
    textfield.layer.borderColor = UIColor.white.cgColor
    textfield.addTarget(self, motion: #selector(textfieldDidChangeValue), for: .editingChanged)
    textfield.translatesAutoresizingMaskIntoConstraints = false
    return textfield
}()

It’s supposed that when textfield’s content material is modified, the .editingChanged occasion can be referred to as after which name perform textfieldDidChangeValue. It really works effectively in iOS simulator, however not working in my actual iPhone 12 Professional system. It’s my first time to face downside of various conduct between simulator and actual system. What’s the doable repair for it? Thanks.

Xcode: Model 13.3.1 (13E500a)
iOS simulator: iOS 14.7 iPhone 13 professional
actual system: iOS 14.7.1 iPhone 12 professional

[ad_2]

Leave a Reply