• 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: hints for working with text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hints for working with text


  • Subject: Re: hints for working with text
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 18 Dec 2002 12:13:22 -0800

On Wednesday, December 18, 2002, at 08:23 AM, Sly Upah wrote:

I am beginning to think about a project off in the future I may want to
do. I want take a string of text with special sequences in them
such as:
this is normal @bold(make this bold) but this is not bold
@italic(this is italics) @bold(this is bold)
@color(red)this is red @color(blue)now we're blue

and translate these to a displayable string in a Cocoa window. The "@"
indicates the action to take upon the string. I'm not concerned
about how to parse the string, I can do that, the question is how
to make an NSString do what I'm hoping for...color, bold, italics, etc

The fundamental Cocoa class for dealing with styled text is the attributed string. Take a look at the documentation for NSAttributedString, NSMutableAttributedString, and NSTextStorage. Note that NSAttributedString itself is defined in Foundation, but most of the useful attributes are defined in the AppKit, in the AppKit header NSAttributedString.h, so you will need to look at both Foundation and AppKit documentation.

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >hints for working with text (From: Sly Upah <email@hidden>)

  • Prev by Date: Bug with two buttons in a view.
  • Next by Date: Re: "First Run" installation of Application support stuff?
  • Previous by thread: Re: hints for working with text
  • Next by thread: Re: NSToolbar in Preferences Panel
  • Index(es):
    • Date
    • Thread