In MonoTouch (since you asked in C # ... although the previous answer is correct :) that would be:
public override void TouchesBegan (NSSet touches, UIEvent evt)
{
base.TouchesBegan (touches, evt);
var touch = touches.AnyObject as UITouch;
if (touch != null) {
PointF pt = touch.LocationInView (this.View);
}
You can also use UITapGestureRecognizer:
var tapRecognizer = new UITapGestureRecognizer ();
tapRecognizer.AddTarget(() => {
PointF pt = tapRecognizer.LocationInView (this.View);
});
tapRecognizer.NumberOfTapsRequired = 1;
tapRecognizer.NumberOfTouchesRequired = 1;
someView.AddGestureRecognizer(tapRecognizer);
Signs of gesture recognition are good because they encapsulate strokes in reusable classes.
source
share