I would like to create a main view controller in order to handle a custom navigation bar and its behavior.
Then, I would like to subclass this new class to use its behavior and link a "contentView" IBOutlet for each of my ViewControllers.
Here is my BaseViewController.xib:
TestViewController.xib: linking the "contentView" outlet for its parent
TestViewController.h: inherit from BaseViewController
#import "BaseViewController.h"
@interface TestViewController : BaseViewController
@end
TestViewController.m: should use outlets from TestViewController.xib
- (id)init
{
self = [super init];
if (self) {
[[NSBundle mainBundle] loadNibNamed:@"TestViewController"
owner:self
options:nil];
}
return self;
}
Obviously, I would like to have the green bar from MainViewController with the white view and the label from TestViewController, but it's actually not working, here is the result:
If in TestViewController.xib, I link the "view" outlet with a view, it's actually overriding this screen and I don't have the green bar from MainViewController, so I guess that my import is working, but I can't understand why it's not working with the contentView.
Any idea ?
Cheers!
Cyril
You will have to decide which controller should control the view with the content.
UIView
as a subview and do all the logic there. The view can also have its own nib file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.