Step 2: Modify Implementation

The implementation of the method is replaced in a manner similar to using an Objective-C category, only "super" has been mapped to allow the new code to call the previous implementation.

The first argument to the MSHookInterface macro is the name of the class we are hooking, and the second is the (unique) name of our new interface.

The third argument is the subclass base for "self", which allows us to get better warnings from the compiler. In this case we are able to use UIColor.

Finally, we call through to the original and modify the result, removing all green from the color and jacking up the red (yielding shades of lavender).

See Also:

C API: MSHookInterface