Instance Method

removeObserver:forKeyPath:

Stops the observer object from receiving change notifications for the property specified by the key path relative to the object receiving this message.

Declaration

- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath;

Parameters

observer

The object to remove as an observer.

keyPath

A key-path, relative to the object receiving this message, for which observer is registered to receive KVO change notifications.

Discussion

It is an error to call removeObserver:forKeyPath: for an object that has not previously been registered as an observer.

Be sure to invoke this method (or removeObserver:forKeyPath:context:) before any object specified in addObserver:forKeyPath:options:context: is deallocated.

See Also

Registering for Observation

- addObserver:forKeyPath:options:context:

Registers the observer object to receive KVO notifications for the key path relative to the object receiving this message.

- removeObserver:forKeyPath:context:

Stops the observer object from receiving change notifications for the property specified by the key path relative to the object receiving this message, given the context.