Theocacao
Leopard
Design Element
Comment on "Replacing Objective-C Methods at Runtime"
by Uli Kusterer — May 15
One gotcha: This only works if the class you're working on actually implements that method itself. If it inherits the method from some superclass, this won't work as expected.

Due to that, I personally prefer poseAsClass: because it allows you to simply override an existing method, but at the same time reroutes all future requests for the base class to your subclass. Of course, poseAsClass: doesn't retroactively change objects created before the posing happens, but I rarely need that.
Back to "Replacing Objective-C Methods at Runtime"
Design Element

Copyright © Scott Stevenson 2004-2015