Xamarin.ios 如何在Monotouch中实现ShouldChangeCharacters?

Xamarin.ios 如何在Monotouch中实现ShouldChangeCharacters?,xamarin.ios,uitextfield,Xamarin.ios,Uitextfield,我有一个UITextField,我想在其中使用ShouldChangeCharacters委托方法更改字符。但是当我使用textField obj时,它说这与UITextFieldChange不匹配。。。 我应该如何在Monotouch中执行此操作?以下是强制使用所有CAP的示例: textField.ShouldChangeCharacters = (textField, range, replacementString) => { using (NSS

我有一个UITextField,我想在其中使用ShouldChangeCharacters委托方法更改字符。但是当我使用textField obj时,它说这与UITextFieldChange不匹配。。。
我应该如何在Monotouch中执行此操作?

以下是强制使用所有CAP的示例:

    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;
    };
我想这应该是你需要的。我总是倾向于使用Lambda表达式,这样你甚至不需要知道委托类型、参数类型等。我让C#type推断来完成这项工作