• 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: key value observing stops
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: key value observing stops


  • Subject: Re: key value observing stops
  • From: Allan Odgaard <email@hidden>
  • Date: Tue, 24 Feb 2004 17:19:33 +0100

On 24. Feb 2004, at 16:50, Francisco Tolmasky wrote:

Please configure Mail to send letters as plain text -- I prefer to read code in monospaced font after own choosing, which I do not get when you send letters in rich text! :)

The array controller holds instances of my modelClass. I have a custom NSCell being used by my table view subclass and all I want to happen is that whenever the text field changes the model, for the cell to update to show changes. [...]

The problem may be that you invoke setNeedsDisplay: on the table view. This will redraw the table view, but it may not fetch new values from the data source, and so nothing will change -- I assume you wanted to send reloadData!?!

I am not sure I understand your design though, if I do then I would suggest something on the line of:

In the text view subclass you only invoke will/didChangeValueForKey:@"contents" and then you add a method (named contents) to return the text that you would otherwise pass to the model.

In your controller setup code you then do something like:

[textView bind:@"contents"
toObject:controller
withKeyPath:@"changedText"
options:nil];

That way, each time the text changes, the system will send setChangedText: to your controller, with the text as argument.

So you implement that method to a) pass on the text to the model and b) invoke reloadData on the table view.

The model should not need to send any will/didChangeValueForKey: messages.
_______________________________________________
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: key value observing stops
      • From: Francisco Tolmasky <email@hidden>
References: 
 >key value observing stops (From: Francisco Tolmasky <email@hidden>)
 >Re: key value observing stops (From: Allan Odgaard <email@hidden>)
 >Re: key value observing stops (From: Francisco Tolmasky <email@hidden>)

  • Prev by Date: CFPreferences always returning null
  • Next by Date: Re: Alternating row colors in a table view?
  • Previous by thread: Re: key value observing stops
  • Next by thread: Re: key value observing stops
  • Index(es):
    • Date
    • Thread