Trait Collection specialised IB properties can't be changed in traitCollectionDidChange:

Originator:sebastian
Number:rdar://42234720 Date Originated:16.07.2018
Status:closed - duplicate of 35713525 Resolved:
Product:iOS + SDK Product Version:iOS 12, Beta 3
Classification:Bug Reproducible:Always
 
Summary:
When instantiating a view controller from a storyboard, `-[UIView(CALayerDelegate) layoutSublayersOfLayer:]` first calls `-[UIViewController traitCollectionDidChange:]` and then 
`-[UIView _processDidChangeRecursivelyFromOldTraits:toCurrentTraits:forceNotification:]`. The latter sets any properties that have been specialised for a specific trait collection in Interface Builder. Setting a different value in `traitCollectionDidChange:` or `viewWillAppear:` has no effect, leaving no good way of changing the initial value of such a property.

Steps to Reproduce:
- Set background color of a view to a Named Color
- Change the background color in `viewWillAppear:` and `traitCollectionDidChange:` to a different value, for example `[UIColor greenColor]`

Expected Results:
The view's background color is green

Actual Results:
The view's background color is the Named Color

Version/Build:
iOS 12, Beta 3 (16A5318d)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!