Re: Plain Text Editing
Re: Plain Text Editing
- Subject: Re: Plain Text Editing
- From: Brian Amerige <email@hidden>
- Date: Sat, 14 Apr 2007 15:00:26 -0400
- Resent-cc: hac <email@hidden>
- Resent-date: Sat, 14 Apr 2007 15:00:53 -0400
- Resent-from: Brian Amerige <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: email@hidden
You might try using this in NSString:
+ (id)stringWithContentsOfFile:(NSString *)path encoding:
(NSStringEncoding)enc error:(NSError **)error
On Apr 14, 2007, at 2:56 PM, hac wrote:
I'm making a document-based app that writes plain text documents.
I'm new
to Obj-C and having some trouble writing the code to open
documents. My
bugs occur, I think, when I'm trying to convert my NSData from a
text file
to an NSString to put into my NSTextView.
In -loadDataRepresentation, I wrote fileContents = [data
retain];(fileContents is of the NSData type) and in
-windowControllerDidLoadNib, I
wrote [textArea setString:fileContents]; (textArea is my
NSTextView) which
created a warning because fileContents isn't a string, and had no
viable
effect on textArea.
How do I get the data from -loadDataRepresentation into a form that
I can
put into an NSTextView? Thanks.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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