OSXBoilerplate icon indicating copy to clipboard operation
OSXBoilerplate copied to clipboard

Fixed inability to create IBAction methods in preference NSViewControllers

Open jceipek opened this issue 12 years ago • 0 comments

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.

jceipek avatar Aug 26 '12 21:08 jceipek