I use NSClassFromString to alloc viewcontrollers. But this will not let me set a delegate to self. Is it possible?
nibString = @"ViewControllerName";
Class viewControllerClass = NSClassFromString( nibString );
loadedVC = (UIViewController*) [[viewControllerClass alloc] initWithNibName:nibString bundle:nil];
[loadedVC setDelegate:self];
The last line reports No visible@interface for "UIViewController" declares the selector 'setDelegate'
I am sure if I allocate the vc via property it will work but I use this method for convenience - although maybe I should stop if I can give set it's delegate.
Can anyone suggest a solution?