Reputation: 2401
I've never used gestures before, and wrote this bit of code (Note: I am using Xamarin and iOS).
When I use the code below, the only value ever received is "Right", despite what I do in the simulator or on my actual iPhone. I'm stumped as to why. I figure I should either get nothing, or everything should work.
// Swipe gesture
this.View.AddGestureRecognizer(new UISwipeGestureRecognizer(sw =>
{
if (sw.Direction == UISwipeGestureRecognizerDirection.Left) {
txtTestLabel.Text = "Left";
}
else if (sw.Direction == UISwipeGestureRecognizerDirection.Right) {
txtTestLabel.Text = "Right";
}
else {
txtTestLabel.Text = sw.Direction.ToString();
}
}));
Upvotes: 2
Views: 73
Reputation: 32597
The default direction of the UISwipeGestureRecognizer
is right (see the documentation). Set the direction
property to left to track the left swipe.
Upvotes: 4