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

NSMutableAttributedString KVO Not Firing Notification

I'm having a dilemma that I can't seem to solve. I've applied some KVO through a binding to a property on a model, however, because I'm not assigning through dot notation the KVO doesn't get fired. Instead, I'm appending like so: [[self…
Kieran Senior
  • 17,960
  • 26
  • 94
  • 138
0
votes
1 answer

app crashes when [self setValue:forKey:] is called

.h File ... @property(nonatomic,readwrite)NSNumber *isConnectionWithServerEstablished; when ever i setValue for isConnectionWithServerEstablished the app crashes CRASH POINT: [self setValue:Number…
Yadnesh
  • 1,307
  • 3
  • 17
  • 36
0
votes
1 answer

removeObserver fails with Core Data

I am observing a core data value with KVO, but when I remove the observer, I get the message: Cannot remove an observer for the key path "flightname.value" from because it is not registered as an observer. Code below called two times. First time…
János
  • 32,867
  • 38
  • 193
  • 353
0
votes
1 answer

removeObserver for KVO with UINavigationController

I'm trying to use Storyboards and to reduce coupling between my classes using KVC. Like the Contacts app, I have editable fields that push new view controllers where you can edit data. Before I show one of my detailViewControllers, I do things…
Crystal
  • 28,460
  • 62
  • 219
  • 393
0
votes
1 answer

Make NSDocument "edited" when a binded control changes

I have an array of NSDictionaries and a NSDictionary iVar (*selectedDictionary) that points to one of the array's objects. *selectedDictionary points to a different object every time the user selects a different row in a NSTableView. Several GUI…
0
votes
0 answers

KVO notifications of app delegate stop unexpectedly

I have a key in my app delegate that I listen for changes using the following code: [self addObserver:self forKeyPath:@"myKey" options:0 context:nil]; After some time though, the app delegate stops responding to changes to myKey. Why does this…
Matt
  • 9,068
  • 12
  • 64
  • 84
0
votes
1 answer

Cocoa Touch Question. Using KVO in a touch sequence context

I would like to use KVO in the following context: 1) In touchesBegan:withEvent: I alloc/init an instance of an object that I then observe via KVO My intent is to observe varous behaviors of the object throughout its life time. 2) In…
dugla
  • 12,774
  • 26
  • 88
  • 136
0
votes
2 answers

CoreData register global observer for all objects and keys

how can / should I register a KVO observer for all entities and keys, regardless of their type? The purpose of this is to monitor changes to objects and mark them as modified, so that I can provide sync functionality through a JSON API with a web…
George Penn.
  • 383
  • 3
  • 13
0
votes
2 answers

Automatically update NSOutlineView upon model changes without NSTreeController

If I changed my NSOutlineView from using bindings and an NSTreeController to having a data source and a delegate, how would I automatically update the NSOutlineView, if my model tree changes? Should I observe the childNodes property of every single…
DrummerB
  • 39,814
  • 12
  • 105
  • 142
0
votes
1 answer

Is it possible to animate changes to data represented in CorePlot?

I'm looking to use CorePlot to show a bunch of data from an API, I'd like to observe changes so the graph can change dynamically. For the best experience, I'm thinking that the data should be animated. I understand that it's entirely up to me to…
-1
votes
1 answer

how .addObservers and observevalue method works in iOS Swift 5

I am using tableView.addObserver and observeValue method for my Swift project to give tableView Height according to its content. its working completely fine but I don't know how. can someone please explain me with this here's my code. …
-1
votes
1 answer

Why doesn't KVO observer get called on a sub object?

With the following Swift playground, why does the observer inside view never get called? import Foundation @objc class Person: NSObject { @objc dynamic var name = "Taylor Swift" } let taylor = Person() taylor.observe(\Person.name, options:…
lewis
  • 2,936
  • 2
  • 37
  • 72
-1
votes
1 answer

About KVO different behavior in iOS10 and iOS11 without `removeObserver:forKeyPath:`

Once I forgot to call "removeObserver:forKeyPath:" when I was using KVO. On iOS10 simulator, the simulator crashed. But on iOS11 simulator, everything was normal. There's no memory leak and no crash. I'm confused why not calling…
Johnson
  • 3
  • 2
-1
votes
1 answer

About forKeyPath

I am following this tutorial to get to know KVC. stated in that tutorial the following [someObject.someProperty setText:@"This is a text"]; Using KVC: [self setValue:@"this is a text" forKeyPath:@"someObject.someProperty.text"] my questions…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
-1
votes
1 answer

SAPUI5 change detection mechanism

Hello I am writing a research paper on change detection(between model and view) mechanisms across JavaScript frameworks - Virtual DOM, Key-Value Observation, Dirty Checking(Angular JS). I am curious what kind of change detection mechanism is behind…
GeForce RTX 4090
  • 3,091
  • 11
  • 32
  • 58