Whats the role of NSCoder here?
- (id)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self)
{
}
return self;
}
NSCoder handles archiving, most particularly in this typical case of a view, the archiving of a NIB. So when you initWithCoder the NIB is loaded, with the interface you've constructed in Interface Builder.
You can read more here: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Protocols/NSNibAwaking_Protocol/Reference/Reference.html