NumericUITextField
class NumericUITextField : UITextField, UITextFieldDelegate
Class overriding a UITextField in order to enable numeric input only…
-
Tells the delegate when the user changes the text or attributes in the specified text field. Used here to fix the “. ” back to double space
Declaration
Swift
func editingChanged(_ textField: UITextField)Parameters
textFieldThe text field containing the changes.
-
Asks the delegate whether to replace the specified text in the text field. Used here to check if entered text conforms a characterset holding decimal values.
Declaration
Swift
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> BoolParameters
textFieldThe text field containing the changes.
rangeThe current selection range.
textThe text to insert
Return Value
True if the old text should be replaced by the new text; false if the replacement operation should be aborted.
NumericUITextField Class Reference