On Tue, Mar 17, 2009 at 10:41 PM, Peter Zegelin <pe...@fracturedsoftware.com> wrote: > In the same vein I have two other bits where I would like to automatically > replace text. The first is my 'Warranty Panel'. I am currently loading it > into an NSTextView like so: > > [warrantyTextField readRTFDFromFile:[[NSBundle mainBundle] > pathForResource:@"LicenseAgreement" ofType:@"rtf"]]; > > Because it is rtf, I understand it is much more involved to change all > occurrences of <ApplicationName>. Does anyone know of an example how this is > done? I found a few things like OmniAppkit that have a Find and Replace > Panel but they seem way too complicated for this.
It's actually quite straightforward. Assuming warrantyTextField is actually an NSTextView (in which case you really ought to change the name), [[warrantyTextField textStorage] mutableString] will give you an instance of NSMutableString which reflects changes back to the text view. Use your standard NSMutableString manipulations on that, and that's all you have to do. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com