swizzling

Overriding / Swizzling methods from an existing shared delegate

Is it possible to override ONLY CERTAIN functions from an exisiting delegate, without ourself being a delegate totally? I tried replacing the target IMP with mine, didn't work :'( More detail: +[SomeClass sharedDelegate] -[sharedDelegate targetMethodToBeOverridden:Arg:] //OUR method needs to be called, not this Method *targetMetho...

HLSL Swizzle - in C#

Hi all, I am looking for a way to implement the swizzle functionality found in HLSL in C#, for those of you unfamiliar with what this is - it is used for easy vector element access. Vector4 v1, v2; // (t,x,y,z) or (alpha,r,g,b) v1 = new Vector4 (1,2,0,0); v2 = new Vector4 (0,0,3,4); // v1 (Green, Z) = v2 (Y, Blue) v1.gz = v2.yb; // R...

Method Swizzle on iPhone device

I tried both JRSwizzle, and MethodSwizzle. They compile fine on the simulator but throw a bunch of errors when I try to compile for Device (3.x) Has anyone had any luck swizzling on the iphone? Whats the trick? TIA ...

How do disk pointers work?

Suppose I want to store a complicated data structure (a tree, say) to disk. The internal pointers which connect nodes in my data structures are pointers, but I can't just write these pointers to disk, because when I read the data structure back the memory locations will have changed. So what is the right way to store the pointers on di...

How to swizzle a class method on iOS?

Method swizzling works great for instance methods. Now, I need to swizzle a class method. Any idea how to do it? Tried this but it doesn't work: void SwizzleClassMethod(Class c, SEL orig, SEL new) { Method origMethod = class_getClassMethod(c, orig); Method newMethod = class_getClassMethod(c, new); if(class_addMethod(c, orig, method_g...

Replacing the content of UIImage(s) loaded from XIB at runtime

For a concept I'm developing, I need to load XIB files manually and by using class and instance method swizzling I have been able to intercept calls to imageCustomNamed, imageCustomWithContentsOfFile and imageCustomWithCGImage for the UIImage class and initCustomWithImage for UIImageView. What I want to to is detect the image name and re...