ColorMatchTabs icon indicating copy to clipboard operation
ColorMatchTabs copied to clipboard

willTransitionToTraitCollection is not forwarded to TabsViewController

Open mooseDev opened this issue 8 years ago • 4 comments

Currently

    override func willTransitionToTraitCollection(newCollection: UITraitCollection, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {

        super.willTransitionToTraitCollection(newCollection, withTransitionCoordinator: coordinator)
    }

gets never called in a viewController of a tab bar item.

Same applies to

override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
        super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
    }

mooseDev avatar Aug 10 '16 12:08 mooseDev

Hi @mooseDev! Because in only portrait orientation a trait collection is still the same. If you enable landscape orientation these methods get called. It also can happen if you locked changing orientation on your device

serejahh avatar Aug 11 '16 05:08 serejahh

Hmm...

Let me explain it again:

Example Project:

  • Add 'Landscape Left/Right' to targets device orientation
  • ExampleViewContoller.swift : Add ' willTransitionToTraitCollection' and 'viewWillTransitionToSize' like mentioned above
  • StubContentViewController.swift: Add ' willTransitionToTraitCollection' and 'viewWillTransitionToSize' like mentioned above

Action:

  • Run and change orientation and set breakpoint to the added functions

Result:

  • Only in ExampleViewController.swift we hit the breakpoints & not in the child view controllers (StubContentViewController.swift)

mooseDev avatar Aug 18 '16 17:08 mooseDev

I got your point. I'll investigate the issue later. Thanks for reporting!

serejahh avatar Aug 18 '16 17:08 serejahh

thanks :)

mooseDev avatar Aug 18 '16 18:08 mooseDev