Skip to content

Instantly share code, notes, and snippets.

@nicwise
Created February 23, 2012 03:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nicwise/1889882 to your computer and use it in GitHub Desktop.
Save nicwise/1889882 to your computer and use it in GitHub Desktop.
public class BTPinchGestureRecognizer : UIPinchGestureRecognizer
{
public BTPinchGestureRecognizer(NSObject target, Selector action) : base(target, action)
{
ShouldReceiveTouch += (sender, touch) => {
//if (touch.View is UISlider || touch.View is MPVolumeView) return false;
return true;
};
}
}
public class OverviewDialogViewController : DialogViewController
{
public OverviewDialogViewController () : base()
{
Style = UITableViewStyle.Plain;
}
public override void LoadView ()
{
base.LoadView ();
//setup stuff
//most likely you can just use a UIPinchGestureRecognizer not the custom one... I was using custom for swipes....
TableView.AddGestureRecognizer(new BTPinchGestureRecognizer(this, new Selector("pinch")));
and the pinch handler:
[Export("pinch")]
public void Pinch(UIPinchGestureRecognizer sender)
{
if (sender.State == UIGestureRecognizerState.Ended)
{
SystemSound.Vibrate.PlaySystemSound();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment