I have added UITextFields programmatically. Here is an example:
addingItemView = UIView(frame: CGRect(x: 0, y: 0, width: viewWidth, height: viewHeight))
let itemNameTextField = UITextField(frame: CGRect(x: 20, y: 40, width: textFieldWidth, height: 20))
itemNameTextField.becomeFirstResponder()
itemNameTextField.placeholder = NSLocalizedString("itemName", comment: "")
itemNameTextField.keyboardType = .default
itemNameTextField.autocorrectionType = .no
itemNameTextField.backgroundColor = UIColor.white
itemNameTextField.layer.cornerRadius = 3
itemNameTextField.borderStyle = .roundedRect
itemNameTextField.clearButtonMode = .whileEditing
itemNameTextField.addTarget(self, action: #selector(assignValueToItemName), for: .editingDidEnd)
addingItemView.addSubview(itemNameTextField)
The issue is: when user is typing more characters than UITextField length, text is not being horizontally scrolled to the left like it happens by default with UITextFields that were added in Storyboard. So user is not able to see what is he typing there.
I have tried to find respective property in UITextField class and in storyboard inspector - no luck. Checked some answers here, for example this, but was not able to find how to scroll text.
Bad example (cursor is not visible, but it's screenshot issue, coz it's blinking):
Good example (TextField added in Storyboard, cursor is not visible, but it's screenshot issue, coz it's blinking):
Kindly advise what am I missing here? Should I implement EditingChanged method and scroll text programmatically? I tried, but did not understand how to do it. I guess moving cursor to position is not the same thing.