I created an objective-c class "customTable.h" subclassing UIView.
I then created a custom View in XIB. I went to the identity inspector and under custom class I chose the name of the class I created (customTable) as file's owner. In the customTable View in the xib I added a couple UILabels and a subview. For the subview I selected it and went under custom class and chose another custom class 'menuTable.'
In the customTable.h file I have linked the menuTable from the XIB as an IBOutlet, because I want to be able to do some configuration of the outlet in the view's initialization.
in the customTable.m file I have:
- (id)init
{
if(self = [super init])
{
[self initialize];
}
return self;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self initialize];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
if(self = [super initWithCoder:aDecoder])
{
[self initialize];
}
return self;
}
- (void)initialize
{
/*some special configuration code for menuTable
is here */
}
In Storyboard I added a subview to a ViewController's view and then told storyboard I wanted the subview to use the custom class "customTable." In the viewcontroller's .h file I linked this view as an IBOutlet.
@property (weak, nonatomic) IBOutlet customTable *cView;
When I run it in simulator the subview doesn't show up in the viewcontroller. I added some break points to the customTable.m file and the initialize methods are being called. So why is it not appearing?
nilor that the element isn't visible in the view controller? - Ben Flynn