Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Appending NSStrings to an NSTextView



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!




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.