RayChen RayChen - 1 year ago 216
iOS Question

traitCollectionDidChange not called when multitasking

I'm work on adopting multitasking to support split view for app. But I find the traitCollectionDidChange not called when app is on the right. Does anyone have idea about this?

Answer Source

Have you tried the viewWillTransitionToSize method? This is used to notify the container that the size of its view is about to change.


- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator


func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
    coordinator.animateAlongsideTransition(nil, completion: {
    if UIDevice.currentDevice().orientation.isLandscape.boolValue {
    } else {