The document of UITraitEnvironment says:
This method is called automatically when the current trait collection changes. Overriding this method provides you with a way to customize behavior when the trait collection associated with the view changes. If you do not override this method, no special behavior is performed.
But when I rotate the simulator this overridden method in my UIView subclass is not called.
My code looks like:
override func traitCollectionDidChange(previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
println("______________________________")
}
Did I miss anything? Or I understand the API doc wrongly? thx for shedding light on it.
Are you tested on the iPad?
Probably because on the iPad the trait collection are all Regular for vertical and horizontal on both portrait and landscape.
Try this method it should work.
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
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