The solution I came up with is below:
- Add a container UIView (for reference ScrollViewHolder)on top of the customized view
- Then add the UIScrollView on the view ScrollViewHolder.
----Custom UIView
----------------Another UIView
-------------------------------UIScrollView
--------------------------------------------Sub Views in ScrollView
The init method is now changed to the following:
-(id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
//Allocation and Initialization of Container View
[super addSubView:ScrollViewHolder];
//Allocation and Initialization of ScrollView
//...
[ScrollViewHolder addSubView:scrollView];
}
return self;
}