I'm having this weird problem with size classes.
I noticed that any UIView which isn't installed in Any-Any
size class is not part of the subviews when viewDidLoad is called.
Meaning I don't have access to it via my outlet nor does it appear in the [self.view subviews]
array.
The subviews are placed fine on screen, and the first time I get to access them is in viewDidAppear
.
I'm developing my app only for portrait iPhones so I set my Storyboard for compact width and regular height.
Am I doing something wrong? Do I need my storyboard to support Any-Any even though I don't really use this configuration?
AutoLayout hasn't completed until after the final viewDidLayoutSubviews
call just before viewDidAppear
.
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
//Do your job with views or with its constraints...
}
You need your storyboard to support Any-Any even though you don't really use this configuration. You have to enable Size Classes in Interface Builder, to do that please refer the following link.
https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/EnablingAdaptiveSizeDesign.html#//apple_ref/doc/uid/TP40014436-CH1-SW1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With