Hi,
I'm having a bit of trouble understanding shared window controllers. I'm
using the Sketch project for reference. In the NSWindowController subclasses
of the shared controllers, there's a class method that reads like:
+ (id)sharedToolPaletteController {
static SKTToolPaletteController *sharedToolPaletteController = nil;
if (!sharedToolPaletteController) {
sharedToolPaletteController = [[SKTToolPaletteController
allocWithZone:NULL] init];
}
return sharedToolPaletteController;
}
I don't understand how this will only cause one instance of the controller
to be instantiated and shared by anyone who calls it. Wouldn't
*sharedToolPaletteController get set to nil every time the function is
called? Or does the "static" label cause it to do something different?
Thanks,
King Chung Huang
Learning Commons
University of Calgary
_______________________________________________
studentdev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/studentdev
Do not post admin requests to the list. They will be ignored.