I've created a UIViewController
that we can call MyViewController1
. When I call MyViewController1
, all my IBOutlet
are nil in viewDidLoad
(and in the rest of the code too).
When I create this controller by doing
MyViewController1 *vc = [[MyViewController1 alloc] init]
,
if I replace MyViewController1
by an other one, for example MyViewController2
, it works. So I guess the problem is really in MyViewController1
.
Last thing you might want to know, is that MyViewController1
is actually a subclass of MySuperViewController1
that is a UIViewController
.
Thanks for your help !
EDIT
I realized my case was maybe more complicated. Here are my exact files :
// MySuperViewController1
MySuperViewController1.h
MySuperViewController1.m
MySuperViewController1.xib
// MyViewController1
MyViewController1.h
MyViewController1.m
So the nib belongs to the superclass, and not the subclass. Can I do that ?
MyViewController1 *vc = [[MyViewController1 alloc] initWithNibName:@"younibname"];
Have it a try. – ShellMyViewController1 *vc = [[MyViewController1 alloc] initWithNibName:@"MySuperViewController1"];
– Shell