I'm trying to do something really complicated, and I'm still looping. I am trying an instance UIViewControllerwith a Nib file inherited from another UIViewControllerwith a different Nib file.
The problem is that I create my son UIViewController.
- (id)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil
{
if ((self = [super initWithNibName:nibNameOrNil
bundle:nibBundleOrNil])) {
}
return self;
}
The init method initWithNibName:bundle:should call super class, but it only calls its own nib file. In the superclass, I tried to override the method initWithNibName:bundle:and put the name nibName myself:
- (id)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil
{
if ((self = [super initWithNibName:@"MotherViewController"
bundle:nibBundleOrNil])) {
}
return self;
}
It only initializes and displays Mother Classits IB object. I understand why, but I'm starting to think that it's impossible to do what I want. Any suggestion?
Edit:
I would use my SonViewController like this:
SonViewController *son = [[SonViewController alloc]
initWithNibName:@"SonViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:son animated:YES];
[son release];
It should display the son and mother of IB Object ...
,
kl94