Appending NSStrings to an NSTextView
Appending NSStrings to an NSTextView
- Subject: Appending NSStrings to an NSTextView
- From: David Rehring <email@hidden>
- Date: Sun, 30 Dec 2001 23:15:47 -0800
I need to append an NSString to an NSTextView and there doesn't seem to be a
non-hackish way of doing it.
Right now, to do this, I'm:
NSRange currentRange = [textView selectedRange];
NSRange allRange;
NSRange appendRange;
[textView selectAll:self];
allRange = [textView selectedRange];
[textView setSelectedRAnge:currentRange];
appendRange = NSMakeRange(NSMaxRange(allRange), 0);
[textView replaceCharactersInRange:appendRange withString:appendString];
This doesn't feel like the one-true-way. What would a more appropriate way
to append text be?
Later,
--
David Rehring Psychos do not explode when light hits
Senior Software Engineer them, no matter how crazy they are...
Atimi Software, Inc.
www.atimi.com And totally insane guy!