 |
 |
NSTextView & readRTFDFromFile:
|
 |
|
 |
|
Junior Member
Join Date: Dec 2000
Location: Houston, TX, USA
Status:
Offline
|
|
Hello-
I'm having a hard time trying to figure out how to open an RTF file into a document based application and displaying it in my NSTextView. Is the method readRTFDFromFile all i need to do? Or do i need to update the NSTextView in any way? In my subclass of NSDocument i choose to override the "readFromFile  fType:" and "writeToFile  fType:" rather than the defualt methods given when you create a new Doc based app in PB. Is this correct? Any help is appreciated. Thanks!
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status:
Offline
|
|
I'm not quite sure of the answer but I know where you can find the answer. Along with the developer tools is the source to TextEdit. You can find it in /Developer/Examples/AppKit/TextEdit/
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status:
Offline
|
|
Using readRTFDFromFile (or loading the RTF file into an NSData and using replaceCharactersInRange:withRTF  should be fine.
However, keep in mind that when readFromFile:ofType: is called, the nib may not have been loaded yet, meaning all of your outlets are still nil. You can either call [self window] first to ensure the nib is loaded, or you can keep track of the filename in an ivar and call readRTFDFromFile in windowControllerDidLoadNib.
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Dec 2000
Location: Houston, TX, USA
Status:
Offline
|
|
Hey, i think that may be the solution i'm looking for-loading the nib. I'll try it out in a bit. Thanks!
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |