How do you remove an observer from an object under ARC? Do we just add the observer and forget about removing it? If we no longer manage memory manually where do we resign from observing?
For example, on a view controller:
[self.view addObserver:self
forKeyPath:@"self.frame"
options:NSKeyValueObservingOptionNew
context:nil];
Previously, I would call removeObserver:
in the view controller's dealloc
method.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…