Showing loading problems when using size classes

I had this strange problem with size classes.

I noticed that any UIView that is not set in an Any-Any size class is not part of subviews when calling viewDidLoad. Value I do not have access to it through my outlet and does not appear in the [self.view subviews] .

The subviews are posted on the screen, and the first time I access them is in viewDidAppear .

I develop my app only for portrait iPhones, so I set my storyboard for compact width and normal height.

Am I doing something wrong? I need my storyboard to support Any-Any, although I really don't use this configuration?

+5
source share
2 answers

Autostart is not completed until the last call to viewDidLayoutSubviews before viewDidAppear .

 - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; //Do your job with views or with its constraints... } 
+1
source

You need your storyboard to support Any-Any, even if you are not using this configuration. You must enable the size classes in the interface builder, for this, refer to 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

+1
source

Source: https://habr.com/ru/post/1216406/


All Articles