示例#1
0
        private static void Hijack(NSObject obj, string selector, ref IntPtr originalImpl, CaptureBooleanDelegate captureDelegate)
        {
            var method = class_getInstanceMethod(obj.ClassHandle, new Selector(selector).Handle);

            originalImpl = method_getImplementation(method);
            if (originalImpl != IntPtr.Zero)
            {
                var block_value = new BlockLiteral();
                block_value.SetupBlock(captureDelegate, null);
                var imp = imp_implementationWithBlock(ref block_value);
                method_setImplementation(method, imp);
            }
        }
示例#2
0
 private static void Hijack(NSObject obj, string selector, ref IntPtr originalImpl, CaptureBooleanDelegate captureDelegate)
 {
     var method = class_getInstanceMethod (obj.ClassHandle, new Selector (selector).Handle);
       originalImpl = method_getImplementation (method);
       if(originalImpl != IntPtr.Zero) {
     var block_value = new BlockLiteral();
     block_value.SetupBlock(captureDelegate, null);
     var imp = imp_implementationWithBlock(ref block_value);
     method_setImplementation(method, imp);
       }
 }