.Hi,
I have a nib file that contains an header that will be used in most of my views, so that I can change it's layout just once when I need. I'd like to know if it's possible to add the header nib view with interface builder, or if I need to do that programmatically and how should it be done.
I've thought about setting the subclass of the subview to a UIView subclass that automatically loads the nib file.
- (id)initWithFrame:(CGRect)frame {
UIView *cell;
NSArray *nib = [[NSBundle mainBundle] loadNibNamed: @"MainHeaderView"
owner: self
options: nil];
for (id oneObject in nib)
if ([oneObject isKindOfClass: [UIView class]])
cell = (UIView *) oneObject;
if ((self = [super initWithFrame: [cell frame]])) {
// Initialization code
}
return self;
}
But this also doesn't seem to work.