ETLayoutItem+KVO

Authors

Quentin Mathe (qmathe@club-internet.fr)
Layout item Key Value Observing support.

Copyright: (C) 2009 Quentin Mathe

Software documentation for the ETLayoutItem(KVO) category

ETLayoutItem(KVO)

Declared in:
ETLayoutItem+KVO.h

WARNING: Unstable API.

Method summary

didChangeValuesForKeys: 

- (void) didChangeValuesForKeys: (NSSet*)affectedKeys;
Description forthcoming.

observableKeyPaths 

- (NSSet*) observableKeyPaths;

Returns the observable properties.

This method is only invoked when -addObserver: is used. e.g. ETPropertyViewpoint doesn't use it to observe a layout item.

We also expose some NSObject properties as observable such as -UTI .

You must call the superclass implementation when you override this method.

You must not make weak references observable unless you nullify them explicitly when the object they reference is going to be deallocated.
You must not use a setter to nullify a weak reference, because this can result in a KVO notification when the setter owner is currently being observed.
e.g. Nullifying the 'parentItem' backward pointer with [item setParentItem: nil] results in a KVO notification when the child is observed by some other object. The issue is that the old 'parentItem' value can be retained by the KVO change dictionary when the 'parentItem' deallocation is underway. Which means, that when the change dictionary is released, the 'parentItem' will be sent -release too. At this point, the parent item retain count is zero and -dealloc will be incorrectly reentered.


willChangeRepresentedObjectFrom: to: 

- (NSSet*) willChangeRepresentedObjectFrom: (id)newObject to: (id)oldObject;
Description forthcoming.