FROM : Jonathan Fewtrell
DATE : Tue Nov 27 17:27:23 2007
I have an NSTextField bound to a certain key in a Core Data model
entity. A switch in the interface allows the user to display the
value in either of two formats. The formats are quite different, so I
have two different NSFormatter subclasses and I set the appropriate
one when the user toggles the switch. I find that the displayed value
immediately after a switch is spurious, So I want to force the field
to redisplay. Nothing I try seems to get it to redisplay. I have
tried the following:
sending -setNeedsDisplay: to the field
sending -display to the field
setting the field hidden and then unhidden
sending a -willChangeValueForKey: / -didChangeValueForKey; pair to
the model object
It appears that because the underlying value of the key (which is an
NSNumber) does not change, the field refuses to update. The only way
I can get it to work is to change the value of the key and change it
back again. But this seems a clumsy hack. Is there a better way?
DATE : Tue Nov 27 17:27:23 2007
I have an NSTextField bound to a certain key in a Core Data model
entity. A switch in the interface allows the user to display the
value in either of two formats. The formats are quite different, so I
have two different NSFormatter subclasses and I set the appropriate
one when the user toggles the switch. I find that the displayed value
immediately after a switch is spurious, So I want to force the field
to redisplay. Nothing I try seems to get it to redisplay. I have
tried the following:
sending -setNeedsDisplay: to the field
sending -display to the field
setting the field hidden and then unhidden
sending a -willChangeValueForKey: / -didChangeValueForKey; pair to
the model object
It appears that because the underlying value of the key (which is an
NSNumber) does not change, the field refuses to update. The only way
I can get it to work is to change the value of the key and change it
back again. But this seems a clumsy hack. Is there a better way?
| Related mails | Author | Date |
|---|---|---|
| Jonathan Fewtrell | Nov 27, 17:27 | |
| Matt Neuburg | Nov 27, 19:10 | |
| Jonathan Fewtrell | Nov 29, 19:59 |






Cocoa mail archive

