Re: Please help?...
Re: Please help?...
- Subject: Re: Please help?...
- From: Scott Anguish <email@hidden>
- Date: Fri, 22 Feb 2002 01:49:25 -0500
are you sure this isn't working?
part of the problem is that you're not actually doing anything with the
fileContents by the looks of things.. that's something that is usually
handled in the windowControllerDidLoadNib:.. and you're not calling
super there either.. which may be an issue at some point...)
so nothing is going to happen in your UI.. you just have a variable
(fileContents) set with the data..
- (void)windowControllerDidLoadNib:(NSWindowController *) aController;
{
[super windowControllerDidLoadNib:aController];
if (fileContents)
{
// this line would be different in your implementation...
// say, replaceCharactersInRange:withRTF:
[theTextView setString:fileContents];
[fileContents release];
fileContents = nil;
}
}
also, you really don't need to copyWithZone:.. you could just retain the
data if you wanted to (and Zones are sort of unnecessary for most apps
according to general scuttlebutt)
On Thursday, February 21, 2002, at 09:23 PM, Albert Atkinson wrote:
Hello!
I am trying to implement a simple saving and loading of rtf files in my
app. I have the following code in my "Document.m" file:
#import "Document.h"
@implementation Document
- (NSString *)windowNibName
{
return @"Document";
}
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
}
- (NSData *)dataRepresentationOfType:(NSString *)aType {
NSAssert([aType isEqualToString:@"rtf"], @"Unknown type");
return [textView RTFFromRange:NSMakeRange(0, [[textView
textStorage]
length])];
}
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType {
NSAssert([aType isEqualToString:@"rtf"], @"Unknown type");
fileContents = [data copyWithZone:[self zone]];
return YES;
}
@end
I must be doing something wrong because this does not work. Any
suggestions?
Thanks!
Albert
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.