• 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
NSWrapper Plus Plain text files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSWrapper Plus Plain text files


  • Subject: NSWrapper Plus Plain text files
  • From: Lincoln Green <email@hidden>
  • Date: Fri, 14 Mar 2008 18:43:13 -0500

Hi, I am using loadFileWrapperRepresentation to implement a RTF/RTFD reader. My code for RTF and RTFD support works, but I can't figure out how to load in .txt files. the basic flow of the reader is, determine the file type, set a NSAttributedString to a certain value depending on the file type, and then load it into a textView. see the following code.(rtfData is an NSAttributedString; textView is my TextView).

if ([type isEqualToString:@"Rich-Text With Attachments"]) {
rtfData = [[NSAttributedString alloc]initWithRTFDFileWrapper:wrapper documentAttributes:nil];
}
else if ([type isEqualToString:@"Rich-Text"]) {
rtfData = [[NSAttributedString alloc]initWithRTF:[wrapper regularFileContents] documentAttributes:nil];
}
else
{
//code for plain text
}


if (textView) {
[[textView textStorage]replaceCharactersInRange:NSMakeRange(0, [[textView string] length])withAttributedString:rtfData];
[rtfData release];
return YES;
}
Any suggestions?


Lincoln Green - Head of BinkWorks - the rather unskilled programmer - etc
http://binkworks.com/
_______________________________________________


Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSWrapper Plus Plain text files
      • From: Bill Garrison <email@hidden>
  • Prev by Date: Re: The 'New' item in the File menu is not enabled
  • Next by Date: OT: Cocoa classes in Vancouver, Canada
  • Previous by thread: Re: The 'New' item in the File menu is not enabled
  • Next by thread: Re: NSWrapper Plus Plain text files
  • Index(es):
    • Date
    • Thread