• 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: NSTextView's "data" binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView's "data" binding


  • Subject: Re: NSTextView's "data" binding
  • From: Shawn Erickson <email@hidden>
  • Date: Sat, 28 Apr 2007 10:06:38 -0700


On Apr 28, 2007, at 9:42 AM, Yann Bizeul wrote:

Well, that's my problem, I never know what i should bind to what.

For this specific question, I have a core data application, and a NSArrayController object in my nib, handling collection of "Block"s.
When I add a block, I create a new BlockView, a new Block managedobject, and bind properties of Block to my NSView, if I do not do that way (i.e. if I bind my NSView's property to my Block's property) it does not work, so I do :


[aBlock bind:@"rect" toObject:blockView withKeyPath:@"frameAsString" options:nil]; // Works fine
[aBlock bind:@"data" toObject:blockView withKeyPath:@"data" options:nil]; // problem here


but my "data" binding is special because i'm trying to "bounce" the binding to a NSTextView inside this NSView, like this, in my BlockView code :

[textView bind:@"data" toObject:self withKeyPath:@"data" options:nil];

I thought the bound object is the View object, that's why I bind (I send the bind message to) my NSView, to bind a NSManagedObject property, and then, to my NSTextView, to bind my NSView property.

You're right when you say I do not use any controller but the NSArrayController. should I ?

As you see, I'm quite confused, I'll take a closer look at the doc you pointed me to, I already red them but obviously not fully understood them !

You are essentially using bindings in an direction opposite to what you would normally do. Additionally model objects should never need to know about view objects, it isn't their responsibility.


Normally you do something like the following when using bindings ...

data objects <--- content ---< controller objects <--- bind ---< view objects

I encourage you to stop what you are working on and explore some of the tutorials on Core Data and bindings.

I suggest the following in addition to what Mmalc will/has outlined...

<http://www.cocoadevcentral.com/articles/000080.php>
<http://www.cocoadevcentral.com/articles/000085.php>
<http://www.cocoadevcentral.com/articles/000086.php>

-Shawn
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >NSTextView's "data" binding (From: Yann Bizeul <email@hidden>)
 >Re: NSTextView's "data" binding (From: mmalc crawford <email@hidden>)
 >Re: NSTextView's "data" binding (From: Yann Bizeul <email@hidden>)

  • Prev by Date: Re: NSTextView's "data" binding
  • Next by Date: Re: Rotating an NSView before printing
  • Previous by thread: Re: NSTextView's "data" binding
  • Next by thread: NSScrollView setDocumentView compile error
  • Index(es):
    • Date
    • Thread