本文整理汇总了C#中UITextField.GetOffsetFromPosition方法的典型用法代码示例。如果您正苦于以下问题:C# UITextField.GetOffsetFromPosition方法的具体用法?C# UITextField.GetOffsetFromPosition怎么用?C# UITextField.GetOffsetFromPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITextField
的用法示例。
在下文中一共展示了UITextField.GetOffsetFromPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextShouldChangeCharacters
private bool TextShouldChangeCharacters(UITextField textField, NSRange range, string replacementString) {
native.BecomeFirstResponder ();
source.Delete = false;
if (replacementString == "") {
source.Delete = true;
}
else if (textField.Text.Length > source.MaxLengthFromMask && source.MaxLengthFromMask > 0) {
return false;
}
if (source.Locked) {
return false;
}
else if (source.Mask != null) {
source.SelectionStart = (int)textField.GetOffsetFromPosition (textField.BeginningOfDocument, textField.SelectedTextRange.Start);
source.SelectionEnd = (int)textField.GetOffsetFromPosition (textField.BeginningOfDocument, textField.SelectedTextRange.End);
source.TextLength = native.Text.Length;
} else {
return true;
}
return true;
}
示例2: TextShouldChangeCharacters
private bool TextShouldChangeCharacters(UITextField textField, NSRange range, string replacementString)
{
this.BecomeFirstResponder ();
this.DeleteKey = false;
if (replacementString == "") {
this.DeleteKey = true;
}
else if (textField.Text.Length > this.MaxLengthFromMask && this.MaxLengthFromMask > 0) {
return false;
}
if (this.Locked) {
return false;
}
else if (this.Properties != null && this.Properties.Mask != null) {
this.holder = new TextHolder ();
holder.Text = textField.Text;
this.holder.SelectionStart = (int)textField.GetOffsetFromPosition (textField.BeginningOfDocument, textField.SelectedTextRange.Start);
this.holder.SelectionEnd = (int)textField.GetOffsetFromPosition (textField.BeginningOfDocument, textField.SelectedTextRange.End);
}
else if (this.Properties.MaxLength > 0) {
if (textField.Text.Length + 1 > this.Properties.MaxLength) {
SetErrorMessage ("Max length = " + this.Properties.MaxLength);
return false;
}
}
else {
return true;
}
return true;
}