Questions tagged [key-value-observing]

Key-value Observing or KVO is a technology for observing changes in object properties.

1201 questions
0
votes
1 answer

Adding KVO Notification to property of same object

I want to add KVO notification to one of the properties of controller so that whenever there is a change in that property, observeValueForKeyPath method is invoked in the same controller.Here is what I am trying to do : @interface ViewController…
ArG
  • 637
  • 1
  • 7
  • 12
0
votes
1 answer

insertRowAnimation for the first cell doesn't work when batch inserting in UITableView

Hi Im trying to add an observer for my model to notify UITableview about any changes in the model. with this pattern I can decouple the model and view and I can put UITableViewDataSource in another class. until now everything works well. but the…
Hashem Aboonajmi
  • 13,077
  • 8
  • 66
  • 75
0
votes
1 answer

Creating a KnockoutJS-like tracker in NodeJS

So I'm basically just trying to add watchers to Javascript's Getter/Setter functions but having no luck yet. KnockoutJS (http://knockoutjs.com) does this with .track(). A YouTube video example of track() in…
0
votes
2 answers

Single model update for multiple changes in NSArrayController subclass

I implemented an NSArrayController subclass to implement row reordering with bindings, using the code included in this post as a starting point. In the -tableView:acceptDrop:row:dropOperation: method, I perform the following: [self…
insys
  • 1,288
  • 13
  • 26
0
votes
0 answers

How to observe (KVO) count change in an NSMutableArray

I have an array with nested NSMutableArrays. I would like to be notified when ever one of the nested arrays has a change in number of objects. I have read several methods but do not understand how this is done. (i.e. insertObject:atIndex:)
Avba
  • 14,822
  • 20
  • 92
  • 192
0
votes
2 answers

Crash When Removing Self as Observer - CALayer

I am having a crash in my CALayer subclass when I remove myself as an observer in -(void)dealloc: - (void)dealloc { [[NSUserDefaults standardUserDefaults] removeObserver:self forKeyPath:@"showColorLabels"]; [colorLabel release]; [_color…
Bridger Maxwell
  • 2,081
  • 1
  • 19
  • 25
0
votes
2 answers

Custom Setter in NSManagedObject Subclass

I have a entitiy in my NSMAnagedObject that is depended on other enititys, so after reading the documention on Depend Keys I come up with the following within my subclass + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { NSSet…
Cory
  • 2,302
  • 20
  • 33
0
votes
1 answer

Why doesn't this property update in UI?

I have a simple app: A text box bound to item.title. This property is exposed as a NSString, but internally is a NSMutableString. The problem: Changes to the title property are not reflected in the UI. Here is the implementation of item: @interface…
tenfour
  • 36,141
  • 15
  • 83
  • 142
0
votes
0 answers

KVO versus NSUndoManager

I have a property on my document class called passDescription, of type NSMutableDictionary. When I call setPassDescription:, the current value of the property is archived into an NSData instance using NSJSONSerialization. The property’s backing…
wjk
  • 1,219
  • 11
  • 27
0
votes
2 answers

How to bind value to property of NSWindow in Interface Builder?

I sub-classed NSWindow (named IMWindow) to make my own properties. Now I want to bind the value of NSTextField to one of the property of IMWindow. I know it is possible for NSUserDefaults controllers or app delegate. But it does not provide option…
HKTonyLee
  • 3,111
  • 23
  • 34
0
votes
1 answer

How to force the binding to update when I close the window?

I have some NSTextField on the NSWindow. And I set up the binding of the NSTextField to shared user defaults controller. The problem is, when I type in the text field and close the window (Cmd + W), the value is not written to the shared user…
HKTonyLee
  • 3,111
  • 23
  • 34
0
votes
3 answers

Core Data object with KVO view controller, and gesture-based changes

I have an iPhone/iPad app where one of the main functions is to arrange objects on a plot. I use Core Data to manage the objects' relationships; for this example, I'll talk about Units, which have a to-one relationship to a Plot (and a to-many…
0
votes
1 answer

Key Value Observing not allowing Switch statement on enum

I'm trying to use Key Value Observation to detect a change in the torchMode variable for an AVCaptureDevice. I'm having an issue where the switch statement doesn't recognize the value (which is an enum). Any idea whats going on? I know that the…
zaloo
  • 879
  • 3
  • 13
  • 27
0
votes
1 answer

OS X bindings: UI element isn't committing binding. Why is that?

Look at the simple app screenshot below. There is a text field and a segmented control. There are three bindings in play: textfield value binding goes to NSUserDefaultsController values.TextValue textfield alignment binding goes…
0
votes
0 answers

Delegate not being called when KVO SKSpriteNode's Position (Key Value Observing of CGPoint)

Have tried: [self.hero addObserver:self forKeyPath:@"position.x" options:NSKeyValueObservingOptionNew context:nil]; as well as: KeyPath:@"position" and neither are calling -…
Garfbargle
  • 3,222
  • 2
  • 17
  • 17