• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Replacing a method via categorys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replacing a method via categorys


  • Subject: Re: Replacing a method via categorys
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Tue, 28 Jun 2005 19:21:32 +0200

At 11:24 Uhr +0300 28.06.2005, Ofri Wolfus wrote:
You may want to read this - http://cocoadev.com/index.pl?MethodSwizzling
It explains exactly what you want.

Don't. Use poseAsClass instead. Method swizzling only works as expected if the method to be swizzled actually exists in the class you're working on. If it's a method that was inherited from a superclass, you'll end up replacing the superclass's method -- ouch.


With poseAsClass, you effectively just subclass the class and tell the rest of the app to use your subclass whenever it asks for the superclass. So, to call the original method (whether inherited or not), you can simply call super.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Replacing a method via categorys (From: "Theodore H. Smith" <email@hidden>)
 >Re: Replacing a method via categorys (From: Ofri Wolfus <email@hidden>)

  • Prev by Date: Re: Thwarting classdump, etc.
  • Next by Date: Disabling highlighting. Subclass not receiving method call?
  • Previous by thread: Re: Replacing a method via categorys
  • Next by thread: Re: Replacing a method via categorys
  • Index(es):
    • Date
    • Thread