I am using separate UIView
class which is initiating from awakeFromNib
This is the view hierarchy
of my custom class in which I have to add custom views to contentView
. I am not getting how to add my customViews as subviews to contentView.
This is the try I made and I failed In it.
#pragma mark - UINibLoading
-(void)awakeFromNib {
scrollView.translatesAutoresizingMaskIntoConstraints = NO;
[self loadViewIntoMemory];
[self formUpdateDetailsData];
}
#pragma mark - Private
- (void)loadViewIntoMemory {
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil];
[self addSubview:contentView];
}
- (void)formUpdateDetailsData {
for (int i = 1; i < 5; i++) {
inputTextView = [[UIView alloc] initWithFrame:CGRectMake(15, ((i*44)+(i*15)), inputTextView.frame.size.width, 44)];
[contentView addSubview:inputTextView];
}
for (int i = 5; i < 10; i++) {
inputPickerView = [[UIView alloc] initWithFrame:CGRectMake(15, ((i*44)+(i*15)), inputPickerView.frame.size.width, 44)];
[contentView addSubview:inputPickerView];
}
}