nsfontpanel

Why isn't changeFont: being called from my NSFontPanel?

时光总嘲笑我的痴心妄想 提交于 2019-12-22 08:58:03
问题 I'm creating an NSFontPanel but selecting a font doesn't call the changeFont: method. I have these methods defined in an NSWindowController subclass: - (IBAction)showFontPanel:(id)sender { [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self]; NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; NSFont *theFont = [NSFont fontWithName:[prefs stringForKey:iepFontName] size:[prefs floatForKey:iepFontSize]]; [[NSFontPanel sharedFontPanel] setPanelFont:theFont isMultiple:NO]; [

Name and size from NSFont

家住魔仙堡 提交于 2019-12-10 20:31:45
问题 i've tried to find something in the Internet, but right now I don't have an answer, so it would be great if you can help me! So far I have a NSFont object, but I would like the name (as NSString) and size of the font, so I can output that! It's like [NSFont fontWithName:@"Menlo" size:11]; only backwards, so I get the name "Menlo" and as size 11. Thanks for help! Xcoder from Germany 回答1: The name and size of NSFont are variables with setters and getters ( @property ) so you can easily get them

Why isn't changeFont: being called from my NSFontPanel?

安稳与你 提交于 2019-12-05 19:16:37
I'm creating an NSFontPanel but selecting a font doesn't call the changeFont: method. I have these methods defined in an NSWindowController subclass: - (IBAction)showFontPanel:(id)sender { [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self]; NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; NSFont *theFont = [NSFont fontWithName:[prefs stringForKey:iepFontName] size:[prefs floatForKey:iepFontSize]]; [[NSFontPanel sharedFontPanel] setPanelFont:theFont isMultiple:NO]; [[NSFontManager sharedFontManager] setDelegate:self]; } - (void)changeFont:(id)sender { NSLog(@"changeFont");