How to disable cursor in Swift from UITextField
? Condition - When the user logs in, then enter into application. If user can may me logout from application then not show cursor into UITextField.
First you need to confirm to UITextFieldDelegate and then set you textField like yourTextField.delegate =self
add
yourTextField.resignFirstResponder()
to your code. Call resignFirstResponder to yourTextField. and you can also use below code (According to your need).
In delegate method textFieldDidEndEditing(textField: UITextField)
with checking (if) whether it has some value/text of not.
yourTextField.attributedPlaceholder = NSAttributedString(string: "User Name", attributes: [NSForegroundColorAttributeName: UIColor.whiteColor()]) textUserName.resignFirstResponder()