• 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: NSAttributedString and bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedString and bindings


  • Subject: Re: NSAttributedString and bindings
  • From: "b.bum" <email@hidden>
  • Date: Sun, 6 Jun 2004 09:13:50 -0700

On Jun 5, 2004, at 8:01 PM, Matt Baker wrote:
I'm trying to write a master-detail interface with a NSTextView to show details of a single record and a NSScrollView to show the master list. I am trying to show the first part of the string in the scrollview, and I'm using bindings to control the view.

....

2004-06-05 22:00:17.919 BindingTest1[2306] *** -[NSConcreteMutableData string]: selector not recognized
2004-06-05 22:00:17.919 BindingTest1[2306] *** -[NSConcreteMutableData string]: selector not recognized

Am I wrong in using NSAttributedString to store styled text, or am I using the string converter wrong?

As mmalc indicated, NSTextView has a data and a value binding. The value binding is only enabled when the string is set to not use formatted text. When multiple fonts is enabled, then you must use the data binding. The data binding requires an instance of NSData that contains RTF.

Given that you have an NSAttributedString, you can use....

- (NSData *)RTFDFromRange:(NSRange)range documentAttributes:(NSDictionary *)dict;

... to generate an NSData that'll plug into the text view's data binding.

This would be an ideal situation to create a value transformer. Say...

@interface AttributedStringToDataTransformer : NSValueTransformer
@end

... that could convert the string in both directions. Then you would have a universal solution.

b.bum
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: NSAttributedString and bindings
      • From: Matt Baker <email@hidden>
References: 
 >NSAttributedString and bindings (From: Matt Baker <email@hidden>)

  • Prev by Date: Re: NSObjectController HELP
  • Next by Date: Re: NSAttributedString and bindings
  • Previous by thread: Re: NSAttributedString and bindings
  • Next by thread: Re: NSAttributedString and bindings
  • Index(es):
    • Date
    • Thread