advertisement

Article:
  Giving the Simple Text Editor 'Legs'
Subject:   Modifications
Date:   2006-08-19 09:55:19
From:   dhmclaughlin
Just wanted to let you know that folks are still using these lessons. I am running Tiger 10.4.7, XCode 2.4, and IB 2.5.4.


I was able to make things work with the following modifications to code:


- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
[super windowControllerDidLoadNib:aController];

if ( fileData != nil )
{
[textView replaceCharactersInRange:NSMakeRange(0, 0) withRTFD:fileData];
[fileData release];
}
}


- (NSData *)dataOfType:(NSString *)aType error:anError
{


NSRange range = NSMakeRange(0, [[textView textStorage] length]);
return [textView RTFDFromRange:range];
}


- (BOOL)readFromData:(NSData *)data ofType:(NSString *)aType error:anError
{


fileData = data;
[fileData retain];
return fileData != nil;
}


It doesn't print or read other rtfd files, but it ssave and loads its own files just fine. Thanks for a great series.


1 to 1 of 1
  1. Modifications
    2007-11-09 21:52:10  Psychentist [View]

1 to 1 of 1