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

Re: NSObjectController HELP


  • Subject: Re: NSObjectController HELP
  • From: mmalcolm crawford <email@hidden>
  • Date: Sun, 6 Jun 2004 00:52:46 -0700

On Jun 6, 2004, at 12:15 AM, Vince Ackerman wrote:

The docs for the controller objects reference changing the instance
variables without accessor methods....

Where?

I think it might be reasonable to suggest that it be made explicit somewhere that you must use accessor methods, however:

"The main requirement to make use of KVO is that your model objects be KVO-compliant. In most cases this actually requires no effortthe runtime system adds support automatically. By default, all invocations of KVC methods result in observer notifications. You can also implement manual supportsee Key-Value Observing for more details."
<http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaBindings/Concepts/HowDoBindingsWork.html>


I thought that was the whole point? What is it that the controller is doing then...? I was under
the impression that the NSObjectController was responsible through KVO to update the bound object.

No, as the above document makes clear, the bound object observes the controller and updates itself accordingly (see "Responding to Changes").

It observers the instance variable and updates the bound object as the variable changed. If I have to write special accessor methods then I might as well go back and put my glue code using IBOutlet's and notifications back in my project...... Not much of a labor saving device if that's the case.

There's a significant difference between writing accessor methods that you should really be writing anyway and writing the glue code...

Are you saying my floats and Booleans have to be NSNumber objects and use those set/get methods?

No, as the documentation on KVC/KVO makes clear, you can use scalar values. KVC/KVO will automatically convert scalars to appropriate objects.

<http://developer.apple.com/documentation/Cocoa/Conceptual/ KeyValueCoding/Concepts/DataTypes.html>

So far I haven't been able to get it to update the NSString obj either.......

I suspect that's a different problem. What are the circumstances?

mmalc
_______________________________________________
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: NSObjectController HELP
      • From: mmalcolm crawford <email@hidden>
    • Re: NSObjectController HELP
      • From: Vince Ackerman <email@hidden>
    • Re: NSObjectController HELP
      • From: mmalcolm crawford <email@hidden>
References: 
 >Re: NSObjectController HELP (From: Vince Ackerman <email@hidden>)
 >Re: NSObjectController HELP (From: mmalcolm crawford <email@hidden>)
 >Re: NSObjectController HELP (From: Vince Ackerman <email@hidden>)
 >Re: NSObjectController HELP (From: mmalcolm crawford <email@hidden>)
 >Re: NSObjectController HELP (From: Vince Ackerman <email@hidden>)

  • Prev by Date: Re: More on NSTask and output to NSTextView
  • Next by Date: Re: NSObjectController HELP
  • Previous by thread: Re: NSObjectController HELP
  • Next by thread: Re: NSObjectController HELP
  • Index(es):
    • Date
    • Thread