29 Apr
2010
29 Apr
'10
6:33 p.m.
A common design pattern in cocoa seems to be to have a objc method along the lines: - (void)dealloc { // Stop observing the tool palette. [[NSNotificationCenter defaultCenter] removeObserver:self name:SKTSelectedToolDidChangeNotification object:[SKTToolPaletteController sharedToolPaletteController]]; // Stop observing the document's canvas size. [[self document] removeObserver:self forKeyPath:SKTDocumentCanvasSizeKey]; // memory management stuff removed... } - taken from the Sketch sample. One way to handle this would be to add a finalizer method to act in place of the the dealloc, but is this the best or correct way to handle this? Thanks, Dave.