• 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: Binding not setting model property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding not setting model property


  • Subject: Re: Binding not setting model property
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 18 Jan 2014 20:54:58 -0800

On Jan 18, 2014, at 20:39 , Roland King <email@hidden> wrote:

> Really does look like the binding code only fires for at the end of ..didFinishEditing: and not for any programatic set of any property on the object, at least not one I've been able to find.

That actually makes a lot of sense. It’s quite possible to change the text field *while typing is happening*, and that doesn’t end editing — and shouldn't.

> The only bad bit about this is I had to make the model object a property of the view so the browse button could set the URL property on it, with bindings alone everything was in IB and the view object implementation had no knowledge of the model object at all, it just set a string path onto itself and the model was supposed to pick it up, except it didn't.

I’d say it’s not bad in the way you mean. There’s nothing “bad” in views knowing about model properties. In MVC, it’s explicitly envisaged that the controller would tell the view where to find the data model.

In practice, I never do it that way any more. I always create a derived property on the view or window controller that’s based on the data model property. So, from the views’ point of view, the view/window controller *is* the data model, but it’s insulated from the real data model. (Specifically, doesn’t have to #import the data model header files, which has housekeeping benefits.)

The cost is writing a trivial getter and setter, and a ‘keyPathsForValuesAffecting…’ method in the controller.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Follow-Ups:
    • Re: Binding not setting model property
      • From: Roland King <email@hidden>
References: 
 >Binding not setting model property (From: Roland King <email@hidden>)
 >Re: Binding not setting model property (From: Dave Fernandes <email@hidden>)
 >Re: Binding not setting model property (From: Roland King <email@hidden>)
 >Re: Binding not setting model property (From: Quincey Morris <email@hidden>)
 >Re: Binding not setting model property (From: Roland King <email@hidden>)

  • Prev by Date: Re: Binding not setting model property
  • Next by Date: iOS 7 downloadable fonts
  • Previous by thread: Re: Binding not setting model property
  • Next by thread: Re: Binding not setting model property
  • Index(es):
    • Date
    • Thread