> On 18 Nov 2015, at 11:46 AM, Roland King <r...@rols.org> wrote:
> 
> 
>> On 18 Nov 2015, at 08:26, Graham Cox <graham....@bigpond.com> wrote:
>> 
>> 
>> Anyone know what NSFontManager’s designated initializer is?
>> 
>> I have set the Font Manager’s factory class to my subclass of NSFontManager 
>> is previously discussed, but its -init method is never called. The Font 
>> Manager object is part of MainMenu.xib, which has ‘prefer coder’ unchecked. 
>> In any case, NSFontManager doesn’t implement NSCoding so it does not appear 
>> to expect -initWithCoder: anyway.
>> 
>> —Graham
>> 
>> 
> 
> The documentation claims it’s init()
> 
> "Your font manager class should implement init as its designated initializer.”


Hmmm, oddly enough the documentation set I have does not mention this anywhere 
that I can see.


> 
> It also seems to indicate that having it part of MainMenu.xib is too late

> "This method must be invoked before your application’s main nib file is 
> loaded, such as in the application delegate’s applicationWillFinishLaunching: 
> method.”

That statement is self contradictory. The app’s delegate is part of the 
MainMenu.xib, generally speaking, so that method can’t be invoked before the 
nib is loaded. In any case, experiemnt bears out that the factory class has to 
be set in main().

The standard app template puts the Font Manager in MainMenu.xib by default as 
well, I think - it’s been a very long time since this app was new so things 
might have changed in that regard. However, it’s too late to change that 
because I directly connect some things, such as items in the standard Text 
menu, to the Font Manager instance.

I was setting the factory class in main() and getting the right object class at 
runtime, but my -init method was never called. If I change the class type in IB 
to my subclass, then its init method is now called. If I then remove the 
setting of the factory class from main(), then I get a NSFontManager instance 
even though the class in IB is something else. So for some reason, I need to do 
both to get the right class and have it inited correctly. This seems weird to 
me - maybe the Font Manager is a special case or I’m not propery understanding 
what’s going on (very likely).

—Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to