OSXBoilerplate
OSXBoilerplate copied to clipboard
Fixed inability to create IBAction methods in preference NSViewControllers
The problem was mainly in the line
NSViewController *result = [NSViewController alloc] initWithNibName:nibName bundle:nil];
I changed it to
NSViewController *result = [[NSClassFromString(controllerName) alloc] initWithNibName:nibName bundle:nil];
However, as a result, existingViewControllerForToolbarItem
no longer worked properly; nibName
was sometimes nil. I converted self.viewControllers
into an NSMutableDictionary
mapping from controller names to NSViewController
subclass instances and stopped referring to the view controllers by the nibName
. I also took the opportunity to rename the xib files without the 'Controller'
suffix, as is recommended by Apple's docs.