• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to set attibutes for NSString's drawInRect: withAttributes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set attibutes for NSString's drawInRect: withAttributes?


  • Subject: Re: How to set attibutes for NSString's drawInRect: withAttributes?
  • From: Tom Waters <email@hidden>
  • Date: Sat, 3 Nov 2001 11:24:40 -0800

assuming you have some rect to draw in (r):

[@"Hello" drawInRect:r withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[NSColor redColor], NSForegroundColorAttributeName,
[NSFont systemFontOfSize:24], NSFontAttributeName,
nil]];

will draw Hello in 24pt red.

the attribute names are defined in <AppKit/NSAttributedString.h>, not to be confused with <Foundation/NSAttributedString.h>


On Friday, November 2, 2001, at 12:27 PM, Fei Li wrote:

Hello all,
I want to use NSString addition's drawInRect:(NSRect)
withAttributes:(NSDictionary*) to draw a string in a rect. But how can I set
attributes for the string? What kind of key and value do I need to set for
attributes' NSDictionary, and can I I change font, size for drawing the
strings by set this NSDictionary?

Thanks for any information!


References: 
 >How to set attibutes for NSString's drawInRect: withAttributes? (From: Fei Li <email@hidden>)

  • Prev by Date: Re: Subclasses in projectbuilder
  • Next by Date: Re: XML Parsing
  • Previous by thread: Re: How to set attibutes for NSString's drawInRect: withAttributes?
  • Next by thread: Header name too long for CW 7?
  • Index(es):
    • Date
    • Thread