Created
July 27, 2013 12:53
-
-
Save amay077/6094790 to your computer and use it in GitHub Desktop.
Xamarin.iOS でジェスチャを認識する ref: http://qiita.com/amay077/items/a6754176f2abe339adce
This file contains hidden or 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
| // Tap gesture | |
| this.View.AddGestureRecognizer(new UITapGestureRecognizer(tap => | |
| { | |
| Debug.WriteLine("Double Tap."); | |
| }) | |
| { | |
| NumberOfTapsRequired = 2 // Double tap | |
| }); | |
| // Drag(Pan) gesture | |
| this.View.AddGestureRecognizer(new UIPanGestureRecognizer(pan => | |
| { | |
| var p = pan.TranslationInView(this.View); | |
| var v = pan.VelocityInView(this.View); | |
| Debug.WriteLine("Pan. transration:{0}, velocity:{1}", p, v); | |
| })); | |
| // Pinch gesture | |
| this.View.AddGestureRecognizer(new UIPinchGestureRecognizer(pin => | |
| { | |
| var scale = pin.Scale; | |
| var v = pin.Velocity; | |
| Debug.WriteLine("Pinch. scale:{0}, velocity:{1}", scale, v); | |
| })); | |
| // Swipe gesture | |
| this.View.AddGestureRecognizer(new UISwipeGestureRecognizer(sw => | |
| { | |
| Debug.WriteLine("Swipe."); | |
| })); | |
| // Rotate gesture | |
| this.View.AddGestureRecognizer(new UIRotationGestureRecognizer(ro => | |
| { | |
| var rotation = ro.Rotation; | |
| var v = ro.Velocity; | |
| Debug.WriteLine("Rotate. rotation:{0}, velocity:{1}", rotation, v); | |
| })); | |
| // Long press gesture | |
| this.View.AddGestureRecognizer(new UILongPressGestureRecognizer(lp => | |
| { | |
| Debug.WriteLine("Long press."); | |
| })); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment