• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Automatically replacing part of text in a text label
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically replacing part of text in a text label


  • Subject: Re: Automatically replacing part of text in a text label
  • From: Michael Ash <email@hidden>
  • Date: Tue, 17 Mar 2009 23:17:06 -0400

On Tue, Mar 17, 2009 at 10:41 PM, Peter Zegelin
<email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Automatically replacing part of text in a text label
      • From: Peter Zegelin <email@hidden>
References: 
 >Automatically replacing part of text in a text label (From: Peter Zegelin <email@hidden>)
 >Re: Automatically replacing part of text in a text label (From: Peter Zegelin <email@hidden>)

  • Prev by Date: Re: "selector ... is passed a return code and caller specified in contextInfo" ?!?!
  • Next by Date: Re: cast to pointer from int of diff size & IODisplayCreateInfoDictionary
  • Previous by thread: Re: Automatically replacing part of text in a text label
  • Next by thread: Re: Automatically replacing part of text in a text label
  • Index(es):
    • Date
    • Thread