Women in Technology

Hear us Roar



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.

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Modifications
    2007-11-09 21:52:10  Psychentist [View]

    dhmclaughlin,
    Ok, I'm very new to C, so i need some help.
    Im running through this tutorial and i think im very close.
    im using Tiger 10.4.7, XCode 2.4, and IB 2.5.4. same as you, but when i use your code, i get 2 errors.
    1: filedata is undeclared.
    -how do i declare it and where?
    2: warning: control reaches end of non void function.
    -i have no idea what thats about.

    Any help will be much appreciated.