Reputation: 343
I subclassed NSFontManager and overrode "modifyFont:(id)sender) Then I changed the NSFontManager class in my xib files to the new class. I can see, that the class is initialized, but the overwritten method is never called. Though the NSFontManager method works normal.
What do I wrong?
#import "GFFontManager.h"
@implementation GFFontManager
-(id)init{
if (self = [super init]) {
//this is called
NSLog(@"GFFontManager init");
}
return self;
}
-(void)modifyFont:(id)sender{
//this is never called
NSLog(@"Do something");
[super modifyFont:sender];
}
@end
Upvotes: 2
Views: 298
Reputation: 343
OK - here is how it works:
I added the following to the main.c and it worked like a charm!
#import <Cocoa/Cocoa.h>
#import "GFFontManager.h"
int main(int argc, char *argv[])
{
[NSFontManager setFontManagerFactory: [GFFontManager class]];
return NSApplicationMain(argc, (const char **) argv);
}
Best regards - Gerald
Upvotes: 2