Returns a Boolean value that indicates whether a partial string is valid.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The text currently in a cell.
partialneeds to be modified, upon return contains the replacement string.
nil, if validation fails contains an
NSStringobject that describes the problem.
partial is an acceptable value, otherwise
This method is invoked each time the user presses a key while the cell has the keyboard focus—it lets you verify and edit the cell text as the user types it.
In a subclass implementation, evaluate
partial according to the context, edit the text if necessary, and return by reference any edited string in
partial is acceptable and
partial is unacceptable. If you return
nil, the cell displays
partial minus the last character typed. If you return
false, you can also return by indirection an
NSString object (in
error) that explains the reason why the validation failed; the delegate (if any) of the
NSControl object managing the cell can then respond to the failure in control:didFailToValidatePartialString:errorDescription:. The selection range will always be set to the end of the text if replacement occurs.
This method is a compatibility method. If a subclass overrides this method and does not override
is, this method will be called as before (
is just calls this one by default).