Skip to content

Instantly share code, notes, and snippets.

@chamons
Created November 30, 2017 22:56
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 chamons/9593ff269f382461fe5359b1266573cf to your computer and use it in GitHub Desktop.
Save chamons/9593ff269f382461fe5359b1266573cf to your computer and use it in GitHub Desktop.
public static class NSGesturePatch
{
[DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
public static extern void void_objc_msgSend_Int64 (IntPtr receiver, IntPtr selector, long arg1);
[DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
public static extern void void_objc_msgSend_int (IntPtr receiver, IntPtr selector, int arg1);
public static void SetState (this NSGestureRecognizer t, NSGestureRecognizerState state)
{
if (IntPtr.Size == 8)
void_objc_msgSend_Int64(t.Handle, ObjCRuntime.Selector.GetHandle ("setState:"), (long) state);
else
void_objc_msgSend_int(t.Handle, ObjCRuntime.Selector.GetHandle ("setState:"), (int) state);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment