Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 6. Manipulating Strings > Storing Rich Text

Storing Rich Text

From: richText.m

 6 NSDictionary *keyword = [[NSDictionary
 7     dictionaryWithObject: @"keyword"
 8             forKey: @"type"] retain];
 9 NSMutableAttributedString *program =
10   [NSMutableAttributedString new];
11
12 NSAttributedString *fragment =
13   [[NSAttributedString alloc]
14     initWithString: @"int"
15       attributes: keyword];
16 [program appendAttributedString: fragment];

A string is just a list of characters. Before you display a string, you generally need some other attributes. These attributes describe the typeface, the size, the alignment and underline styles, and so on.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint