UITextFieldChanges Delegate
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Delegate that determines whether text changes should be allowed in a UITextField for multiple ranges.
public delegate bool UITextFieldChanges(UITextField textField, NSValue[] ranges, string replacementString);
type UITextFieldChanges = delegate of UITextField * NSValue[] * string -> bool
Parameters
- textField
- UITextField
The text field that contains the text to be modified.
- ranges
- NSValue[]
An array of NSValue objects containing NSRange values representing the character ranges to be replaced.
- replacementString
- String
The replacement text for the specified ranges. When typing, this typically contains the single new character entered, but may contain multiple characters if pasting. An empty string indicates character deletion.
Return Value
Returns true if the text changes should be allowed; otherwise, false to prevent the modification.
Remarks
This delegate method is called when the text field needs to validate text changes across multiple ranges simultaneously.
Use this method to implement custom text validation logic, such as restricting input to specific formats or preventing certain types of content.
This is the multiple-range version of the standard ShouldChangeCharacters(UITextField, NSValue[], String) method.