Re: CoreData, TextView and Bindings
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