• 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: CoreData, TextView and Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData, TextView and Bindings


  • Subject: Re: CoreData, TextView and Bindings
  • From: Wain <email@hidden>
  • Date: Thu, 1 Dec 2005 18:17:03 +0000


On 1 Dec 2005, at 07:40, Keith Wilson wrote:

Hi all,

Anyone else having problems with Bindings and RTFD Text Views?

My NSTextView started to crash again.

So my advice is DO NOT Bind a RTFD NSTextView using NSUnarchiveFromData as the Value Transformer.

You're right, you shouldn't be doing this, in your circumstances anyway.
You don't need to use the NSUnarchiveFromData transformer because the rtfd is stored as binary data
(NSData) by Core Data and you are binding it to the data (NSData) binding of the NSTextView.
It will just work, no unarchiving required...

You don't need to implement or override any related methods.
You don't need to use attributed strings anywhere.

Wain


I have removed the binding and replaced it with glue code (so far no crashes):

To get the data

if(data)
attribString = [[NSAttributedString alloc] initWithRTFD:data documentAttributes:nil];
else
attribString = [[NSAttributedString alloc] init];

and to save the data:

NSData *data = [attribString RTFDFromRange:NSMakeRange(0, [attribString length]) documentAttributes:nil];

Keith



___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Prev by Date: Re: NSPopUpButton binding
  • Next by Date: Re: Window layering and save sheet attachment in multi-window document
  • Previous by thread: Re: NSSearchField _sendPartialString exception
  • Next by thread: Bindings problem : list of To-Many Relationships (was NSPopupButtonCell handling click too early ? )
  • Index(es):
    • Date
    • Thread