Click here to support Nimbus development and make a donation at www.pledgie.com !
An iOS framework whose growth is bounded by O(documentation).
Runtime Class Modifications

Overview

For modifying class implementations at runtime.

Attention:
Please use caution when modifying class implementations at runtime. Apple is prone to rejecting apps for gratuitous use of method swapping. In particular, avoid swapping any NSObject methods such as dealloc, init, and retain/release on UIKit classes.

See example: Runtime Debugging with Method Swizzling

Functions

void NISwapInstanceMethods (Class cls, SEL originalSel, SEL newSel)
void NISwapClassMethods (Class cls, SEL originalSel, SEL newSel)

Function Documentation

NISwapInstanceMethods ( Class  cls,
SEL  originalSel,
SEL  newSel 
)

Swap two class instance method implementations.

Use this method when you would like to replace an existing method implementation in a class with your own implementation at runtime. In practice this is often used to replace the implementations of UIKit classes where subclassing isn't an adequate solution.

This will only work for methods declared with a -.

After calling this method, any calls to originalSel will actually call newSel and vice versa.

Uses method_exchangeImplementations to accomplish this.

  • [test] Swap two instance methods on a class.
Examples:
ExampleRuntimeDebugging.m.

Definition at line 25 of file NIRuntimeClassModifications.m.

NISwapClassMethods ( Class  cls,
SEL  originalSel,
SEL  newSel 
)

Swap two class method implementations.

Use this method when you would like to replace an existing method implementation in a class with your own implementation at runtime. In practice this is often used to replace the implementations of UIKit classes where subclassing isn't an adequate solution.

This will only work for methods declared with a +.

After calling this method, any calls to originalSel will actually call newSel and vice versa.

Uses method_exchangeImplementations to accomplish this.

  • [test] Swap two static methods on a class.

Definition at line 33 of file NIRuntimeClassModifications.m.

Generated for Nimbus by doxygen 1.7.4-20110629