Created
February 5, 2015 06:41
-
-
Save srkirkland/08adef3270a2c5e487f9 to your computer and use it in GitHub Desktop.
finger tracking pan gesture recognizer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//addtl info at https://github.com/johncadengo/JCWindowShade/blob/master/JCWindowShade/JCViewController.m#L137 | |
var dragging = false; | |
contentView.AddGestureRecognizer (new UIPanGestureRecognizer ((pan) => { | |
if (dragging){ | |
var origin = pan.LocationInView(View); | |
Console.WriteLine ("dragging at {0}", origin); | |
var translated = pan.TranslationInView(contentView); | |
var cf = contentView.Frame; | |
cf.Y = origin.Y; | |
contentView.Frame = cf; | |
} | |
if (pan.State == UIGestureRecognizerState.Began){ | |
Console.WriteLine ("starting drag"); | |
dragging = true; | |
} | |
if (pan.State == UIGestureRecognizerState.Ended){ | |
Console.WriteLine ("ended drag"); | |
dragging = false; | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment