• 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: NSMutableAttributedString binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableAttributedString binding


  • Subject: Re: NSMutableAttributedString binding
  • From: Douglas Davidson <email@hidden>
  • Date: Thu, 10 Jan 2008 09:28:13 -0800


On Jan 10, 2008, at 9:11 AM, Ivan C Myrvold wrote:

I have binded the a NSTextView to an NSAttributedString. This works fine when I set the binded variable, the NSTextView is showing the text fine.
But if I make a change in the variable, this is not reflected in the NSTextView.
I am doing this:


[[self attributedText] replaceCharactersInRange:elementRange withString:[te c]];


and the NSTextView which is binded to attributedText does never show the change.
If I do an NSLog of this variable immediately following the above line, I can see the change.


What should I do to get the NSTextView to show the change?

This isn't a case for bindings, it's a case for using the text system. Each NSTextView already has a mutable attributed string, its text storage, and it listens for changes to the text storage automatically. What you are doing is maintaining two separate copies of the text, and trying to have the text entirely copied over after each change, which would be inefficient. Look at the text system documentation and see how to make changes to the text storage.


Douglas Davidson

_______________________________________________

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: NSMutableAttributedString binding
      • From: Ivan C Myrvold <email@hidden>
References: 
 >NSMutableAttributedString binding (From: Ivan C Myrvold <email@hidden>)

  • Prev by Date: Drag and Drop from Finder to Source List
  • Next by Date: Re: EXC_BAD_ACCESS when trying to use [NSMutableURLRequest setHTTPBodyStream]
  • Previous by thread: NSMutableAttributedString binding
  • Next by thread: Re: NSMutableAttributedString binding
  • Index(es):
    • Date
    • Thread