Hi,all.I am new to cocoa. I am reading Aaron Hillegass's Book "Cocoa Programming for Mac OS X".

I have got some problems with challenge 2 of Chapter 20.I have a custom NSView called BigLetterView, and then it show the input letter on the view.Now I want to make the letter which I just inputted appears in italics. So, I define this method:

- (IBAction) isItalic: (id) sender
{
        if ([italicBox state])
        {
                NSFontManager *fontManager = [NSFontManager     
sharedFontManager];
                [fontManager convertFont: [NSFont fontWithName: @"Helvetica" 
size: 75]
toHaveTrait: NSItalicFontMask];
        }else {
                NSFontManager *fontManager = [NSFontManager     
sharedFontManager];
                [fontManager convertFont: [NSFont fontWithName: @"Helvetica" 
size: 75]
toHaveTrait: NSUnitalicFontMask];
        }

        [self setNeedsDisplay: YES];
}

When I click the italics check button. Nothing happens. How do I suppose to make this wok?
How can I get the font the letter is using?

Thanks.
_______________________________________________

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

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

Reply via email to