FROM : Chad Armstrong
DATE : Wed Jun 21 19:13:38 2006
I'm working my way into learning how to work with a Document-based architecture. Below I have an example of how to save the data from a text view. This works great in just saving that data, but how do I go about saving other data? What if I want to be able to save other information, such as version information, or the date that this document was last read/modified, etc? Also, how would I then extract the data from the saved file? Would this involve a dictionary format, similar to saving user preferences?
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
// Insert code here to write your document from the given data. You can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead.
// return nil;
NSRange range = NSMakeRange(0, [[commentsTextView textStorage] length]);
return [commentsTextView RTFDFromRange:range];
}
Regards,
Chad
DATE : Wed Jun 21 19:13:38 2006
I'm working my way into learning how to work with a Document-based architecture. Below I have an example of how to save the data from a text view. This works great in just saving that data, but how do I go about saving other data? What if I want to be able to save other information, such as version information, or the date that this document was last read/modified, etc? Also, how would I then extract the data from the saved file? Would this involve a dictionary format, similar to saving user preferences?
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
// Insert code here to write your document from the given data. You can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead.
// return nil;
NSRange range = NSMakeRange(0, [[commentsTextView textStorage] length]);
return [commentsTextView RTFDFromRange:range];
}
Regards,
Chad
| Related mails | Author | Date |
|---|---|---|
| Chad Armstrong | Jun 21, 19:13 | |
| David Dunham | Jun 21, 19:45 |






Cocoa mail archive

