Instance Method

updateChangeCount:

Updates the receiver’s change count according to the given change type.

Declaration

- (void)updateChangeCount:(NSDocumentChangeType)change;

Parameters

changeType

The type of change made to the document. For a list of values, see NSDocumentChangeType.

Discussion

The change count indicates the document’s edited status; if the change count is 0, the document has no changes to save, and if the change count is greater than 0, the document has been edited and is unsaved. If you are implementing undo and redo in an app, you should increment the change count every time you create an undo group and decrement the change count when an undo or redo operation is performed.

Note that if you are using the NSDocument default undo/redo features, setting the document’s edited status by updating the change count happens automatically. You only need to invoke this method when you are not using these features.

See Also

Working with Undo Manager

hasUndoManager

A Boolean value indicating whether the document owns or should own an undo manager object.

undoManager

The document’s undo manager object.