I want a \'$\' Sign in the text field which cannot be erased. A user should be able to enter values after it and if he presses backspace it should only erase the value he entere
No need to use shouldChangeCharactersInRange delegate method. The easiest and most convenient solution is this
var label = UILabel(frame: CGRectMake(0, 0, 50, 50))
label.text = "$";
label.backgroundColor = UIColor(white: 0.0, alpha: 0.0)
tenantField.rightViewMode = .Always
tenantField.rightView = label