Material: SnackbarController fails to layout its rootViewController's height correctly

My setup is:

  • Window
    • NavigationDrawerController
      • ToolbarController
        • SnackbarController
          • my view controllers

I’m changing my view controllers by calling .transition(to: targetViewController) on the SnackbarController. The problem I have is that my view controllers have the wrong height.

I’ve debugged some bounds:

// Screen's bounds
print(Screen.bounds)
// The SnackbarController's view's bounds
print(toolbarController?.rootViewController.view.bounds as! CGRect)
// The bounds of my view controller's view
print((toolbarController?.rootViewController as! AppSnackbarController).rootViewController.view.bounds)

The output was:

(0.0, 0.0, 768.0, 1024.0)
(0.0, 0.0, 768.0, 955.0)
(0.0, 0.0, 768.0, 1162.0) // This should be 955, right?

And it even becomes more weird: If change my view controller using .transition, the new view controller’s height increases by 138 everytime. (It’s 138 on all devices) So if I change my view controller, it outputs:

(0.0, 0.0, 768.0, 1024.0)
(0.0, 0.0, 768.0, 955.0)
(0.0, 0.0, 768.0, 1300.0)

And if I change it again, it outputs:

(0.0, 0.0, 768.0, 1024.0)
(0.0, 0.0, 768.0, 955.0)
(0.0, 0.0, 768.0, 1438.0)

Maybe you can take a look… Thanks!

  • Timo

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

I will take a look 😃