I created a separate .xib because I wanted to design a UIView
with autolayout
outside of a viewController. I created the .xib, added the UIView
and the constraints, using wCompact hRegular
. Simple.
Then add it to my viewController
in viewDidLoad
:
UIView *header = [[[NSBundle mainBundle] loadNibNamed:@"HeaderSearch" owner:self options:nil] lastObject];
NSLog(@"%@", NSStringFromCGRect(header.frame));
[self.view addSubview:header];
But, when it is added, the frame size is 600x600 and I cannot figure out why.
What have I done wrong here that is forcing this strange size?
You need to uncheck 'Use size classes' in your xib
and the view frame size will be the one you set and not 600x600