Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to handle mouse and keyboard events in custom UIView on iOS

$
0
0

I am building an app where I add my custom UIView (without any other controls or views involved), and cannot figure out how to handle user events (mouse/touch/keyboard).

I added override for CanBecomeFirstResponder (return true) on both MyUIView and on MyViewController, I called BecomeFirstResponder on my view from inside LayoutSubviews override (doing the same immediately after adding the view to the tree failed, and here it seems working: the IsFirstResponder property returns true). I assigned true to UserInteractionEnabled on my view.

Nothing of that helped. Still when I click with the mouse on my app in iOS simulator I cannot get MotionBegan override called on my view.

Probably I am missing something very seriously, because even if I started getting this MotionBegin, I have no clue as to how to handle keyboard events.

I was expecting to find some sort of OnPointerPressed or OnKeyDown but found nothing.

Please help. Thanks!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>