I have a UITextField where I want to change the characters using ShouldChangeCharacters delegate method. But when I use the textField obj, it says that does not match with UITextFieldChange... How should I do it in Monotouch?
Here is an example of forcing all caps:
textField.ShouldChangeCharacters = (textField, range, replacementString) =>
{
using (NSString original = new NSString(textField.Text), replace = new NSString(replacementString.ToUpper()))
{
textField.Text = original.Replace (range, replace);
}
return false;
};
I think it should be what you need. I tend to use Lambda expressions always, that way you don't need to even know the delegate type, parameters types, etc. I let C# type inference do the work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With