I'm trying to add a View created through a xib File into a UIScrollview.
The View looks like that:
What I get is:
The Code I use to add the View to the UIScrollview (which is setup in Storyboard) is:
Initialisation code:
NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"SpuelungProtokollView" owner:self options:nil];
HPSpuelungProtokollView * spuelungProtokollView = [subviewArray objectAtIndex:0];
HPSpuelung * vInfo = pInfo;
// setup Infos
// ... this part is not related to the problem ...
[self setContentView:spuelungProtokollView];
and then I do the following in viewDidLoad:
:
[[self scrollView] setContentSize:[[self contentView] frame].size];
[[self scrollView] addSubview:[self contentView]];
[[self contentView] layoutIfNeeded];
Has anybody had a similar Problem - know how to properly add a (properly constraint) UIView to UIScrollview?
Thanks in Advance for Answers!
EDIT
A strange Side Effect is: the View loads correctly if I put the view Hirarchy is created in viewDidAppear: