Re: Forcing subclass creation through method swizzling not airtight?
Re: Forcing subclass creation through method swizzling not airtight?
- Subject: Re: Forcing subclass creation through method swizzling not airtight?
- From: Antonio Nunes <email@hidden>
- Date: Sun, 11 Mar 2012 12:28:43 +0000
On 11 Mar 2012, at 09:48, Jean-Daniel Dupas wrote:
> +initialize is not call until you try to use your class.
> So there is no garantee it will be call at all,
Thanks Jean-Daniel,
I think I can be pretty confident it is called, since this initialize is in my NSApplication subclass. Should be called before anything is done that involves PDF documents and pages.
(By the way, now that I noticed the safeguard was missing, I adjusted the method to:
+ (void)initialize
{
if ( self == [NMD_Application class] ) {
...
}
}
> and even if it is called, nothing prevent creation of instance of the super class before it append.
Do you mean before the swizzling occurs? Knowing my code that would be unlikely. The only place where I don't control directly what type of page gets created is in the PDFThumbnailView when a user drags a PDF document in from the Finder, and that can only happen after the app has finished starting up and opened a document. But maybe you mean something else by "before it append"?
-António
----------------------------------------------------
There is nothing as strong as real gentleness, and
there is nothing as gentle as real strength.
----------------------------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden