I would like to set a limit to the number of characters that can be entered into a UITextField in an iOS app to 25 characters.
According to this post, it could be done in Objective-C like this:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSUInteger newLength = [textField.text length] + [string length] - range.length;
return (newLength > 25) ? NO : YES;
}
How can I do this exact same thing in C# with Xamarin.iOS?