Overridden traitCollectionDidChange () method of UIView subclass not called when rotated

The UITraitEnvironment document says:

This method is called automatically when the current collection of sign changes. Overriding this method provides you with a way to customize when the collection of features associated with the view changes. If you do not override this method, there will be no special action.

But when I rotate the simulator, this overridden method in my subclass of UIView is not called.

My code looks like this:

override func traitCollectionDidChange(previousTraitCollection: UITraitCollection?) { 
    super.traitCollectionDidChange(previousTraitCollection)

    println("______________________________")
}

Did I miss something? Or am I misunderstanding the API document? thanks for shedding light on him.

+4
source share
1 answer

Have you tested the iPad?

, iPad - Regular , .

, .

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

+15

All Articles