When again can you set properties for Storyboard objects?

Have a single view controller that operates for both an iPhone storyboard and an iPad storyboard. The view controller scenes for each include a UIView subclass with writeable properties necessary to create a special view.


I can successfully set the properties for the subclass in the view controllers viewDidLoad for the iPhone but the properties are not successfully set for the iPad and the subclass obviously does not perform as designed. Included below are abstracted console listings (for simulators) that show the iPhone the subclass is inited with coder slightly before the viewDidLoad for both devices, so I would think I was safe. When I test the subclass without the rest of the app, it works for both devices in the simulators.


So, again (because I think I used to know this), when can you reliably set properties for storyboard objects within a scene?


iPhone 8 (setting subclass properties works in viewDidLoad)
2017-11-07 14:05:53.191484  initWithCoder: (UIView subclass)
2017-11-07 14:05:53.191915  setUpView (UIView subclass)
2017-11-07 14:05:53.221606  [MC] Lazy loading NSBundle MobileCoreServices.framework
2017-11-07 14:05:53.222767  [MC] Loaded MobileCoreServices.framework
2017-11-07 14:05:53.304210  viewDidLoad (Main View Controller)
2017-11-07 14:05:54.104553  viewWillAppear: (Main View Controller)
2017-11-07 14:05:54.124889  viewWillLayoutSubviews (Main View Controller)
2017-11-07 14:05:54.128485  layoutSubviews (UIView subclass)
2017-11-07 14:05:54.128630  layoutSubviews (UIView subclass)
2017-11-07 14:05:54.129017  viewWillLayoutSubviews (Main View Controller)
2017-11-07 14:05:54.144486  drawRect: (UIView subclass)


iPad Air 2 (setting subclass properties does NOT work in viewDidLoad)
2017-11-07 14:09:14.184502  [MC] Lazy loading NSBundle MobileCoreServices.framework
2017-11-07 14:09:14.185708  [MC] Loaded MobileCoreServices.framework
2017-11-07 14:09:14.218208  initWithCoder: (UIView subclass)
2017-11-07 14:09:14.218519  setUpView (UIView subclass)
2017-11-07 14:09:14.229662  viewDidLoad (Main View Controller)
2017-11-07 14:09:14.410150  viewWillAppear: (Main View Controller)
2017-11-07 14:09:14.419288  viewWillLayoutSubviews (Main View Controller)
2017-11-07 14:09:14.423142  layoutSubviews (UIView subclass)
2017-11-07 14:09:14.423248  layoutSubviews (UIView subclass)
2017-11-07 14:09:14.423658  viewWillLayoutSubviews (Main View Controller)
2017-11-07 14:09:14.441233  drawRect: (UIView subclass)
Answered by DrMiller in 275974022

OK, would still like to know when one can set properties of a child view of a view controller placing the view in IB, but solved the problem by just instantiating the subclass programmatically in viewDidLoad the old-fashioned way 😉

Accepted Answer

OK, would still like to know when one can set properties of a child view of a view controller placing the view in IB, but solved the problem by just instantiating the subclass programmatically in viewDidLoad the old-fashioned way 😉

When again can you set properties for Storyboard objects?
 
 
Q