Firstly I have inspected all of the other questions on this topic: the answers provided seem to be:
- make sure you set the file's owner to your custom view controller class (which I have done)
- make sure you have a referencing outlet from the view to the file's owner (which I have)
My code is compiled to a static library, and I export the .a file and xib file. My example app that uses it includes the xib in its bundle ("copy bundle resources" in build phase)
In my library code I have a function in a separate UIViewContoller subclass to create the view controller from the nib:
- (void) presentCustomController
{
self.vCtrl = [[CustomController alloc] initWithNibName:@"CustomController" bundle:nil];
...
}
When I run the example app, I inspect the _view member of self.vCtrl, and it is 0x0000, and of course this is what causes the exception in the posting title. My understanding was that the view to which that member points was 'auto generated' from the xib file, and it's children were the controls that I have put in it (buttons etc). What part of my understanding has fallen down? Is the problem related to the fact that it is in a static library? Thanks for any help.
[[CustomController alloc] init]
it will pick the nib automatically.