I am working on an iPadOS 13.4 app that works with trackpad input. I have gotten a lot of things working, like two-finger scrolling, right-click (two-finger or control-click), pinch-to-zoom, etc. I have another control that works great with the trackpad but it is a custom text control, so I need to change the round cursor from a circle to an I-beam using the UIPointerInteraction APIs.
I modified an Apple-provided Swift sample code project and got an I-beam to appear over a view so I know what to do if the system will call my styleFor: region method, but it just won't call it. The Xamarin APIs are not yet documented for this; the best is the Assembly Browser and the API diffs here that mention the method signatures. I am on Xamarin.iOS 13.16.1.
public class MyClass: UIView, IUIPointerInteractionDelegate {
...
initalization_code() {
...
UIPointerInteraction interaction = new UIPointerInteraction(this);
this.AddInteraction(interaction);
}
public UIPointerStyle GetStyleForRegion(UIPointerInteraction interaction, UIPointerRegion region) {
// this code is never called
const float HEIGHT = 30f;
return UIPointerStyle.Create(UIPointerShape.CreateBeam((nfloat)HEIGHT, UIAxis.Vertical), UIAxis.Vertical);
}
}
What do I need to do to get iOS to call into my C# code for GetStyleForRegion?