Skip to content

Instantly share code, notes, and snippets.

@kamiyam
Created March 31, 2010 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamiyam/350004 to your computer and use it in GitHub Desktop.
Save kamiyam/350004 to your computer and use it in GitHub Desktop.
PointF startLoc;
int iX_Min = 12;
int iY_Max = 4;
public override void TouchesBegan(NSSet touches, UIEvent evt)
{
var touch = touches.AnyObject as UITouch;
Console.Out.WriteLine("TouchesBegan:" + touch.TapCount);
startLoc = touch.PreviousLocationInView( this.View );
}
public override void TouchesMoved(NSSet touches, UIEvent evt)
{
var touch = touches.AnyObject as UITouch;
Console.Out.WriteLine("TouchesMoved");
PointF currentLoc = touch.PreviousLocationInView(this.View);
float fMovingX = startLoc.X - currentLoc.X;
float fMovingY = startLoc.Y - currentLoc.Y;
if (Math.Abs(fMovingX) >= iX_Min && Math.Abs(fMovingY) >= iY_Max)
{
Console.Out.WriteLine("It's Swipe!");
if (fMovingX > 0)
{
Console.Out.WriteLine("LeftSwipe");
}
else
{
Console.Out.WriteLine("RightSwipe");
}
}
else
{
Console.Out.WriteLine("etc");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment