|
using System;
using System.Diagnostics.CodeAnalysis;
using ObjCRuntime;
using UIKit;
using RectangleF = CoreGraphics.CGRect;
namespace Microsoft.Maui.Platform
{
public class NoCaretField : UITextField, IUIViewLifeCycleEvents
{
public NoCaretField() : base(new RectangleF())
{
SpellCheckingType = UITextSpellCheckingType.No;
AutocorrectionType = UITextAutocorrectionType.No;
AutocapitalizationType = UITextAutocapitalizationType.None;
}
public override RectangleF GetCaretRectForPosition(UITextPosition? position)
{
return RectangleF.Empty;
}
[UnconditionalSuppressMessage("Memory", "MEM0002", Justification = IUIViewLifeCycleEvents.UnconditionalSuppressMessage)]
EventHandler? _movedToWindow;
event EventHandler? IUIViewLifeCycleEvents.MovedToWindow
{
add => _movedToWindow += value;
remove => _movedToWindow -= value;
}
public override void MovedToWindow()
{
base.MovedToWindow();
_movedToWindow?.Invoke(this, EventArgs.Empty);
}
}
} |