0

When I return to my home screen after a logout, it can't return any information about its traitCollection. I would like to get its size class and it is not possible.

enter image description here

When I run the screen without any segue it has all the information:

print(self.view.traitCollection)

<UITraitCollection: 0x14fe47dd0; _UITraitNameUserInterfaceIdiom = Phone, _UITraitNameDisplayScale = 2.000000, _UITraitNameHorizontalSizeClass = Compact, _UITraitNameVerticalSizeClass = Regular, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1, _UITraitNameForceTouchCapability = 1>

But when the screen runs after a custom segue, this is what it display:

print(self.view.traitCollection)

<UITraitCollection: 0x14fe21cc0; >

It doesn't have any information about the view.

The code of the custom segue is the below:

override func perform() {

    self.sourceViewController.presentViewController(self.destinationViewController as UIViewController, animated: false, completion: nil)

}
angeldev
  • 1,983
  • 3
  • 18
  • 29
  • where do the `prints` live? `viewDidLoad`, `viewDidAppear`,... – R Menke Feb 01 '16 at 13:21
  • @RMenke sorry, I do the prints in `viewDidLoad` – angeldev Feb 01 '16 at 13:44
  • How exactly do you present both instances? Please just provide more code. – R Menke Feb 01 '16 at 13:50
  • @RMenke I provided more information. Let me know if you need something more – angeldev Feb 01 '16 at 14:36
  • LogOut screen should not have a segue to Home. It should pop all all presented viewcontrollers until reaching the Home VC. – R Menke Feb 01 '16 at 18:30
  • @RMenke the problem is that when the user is already log in, the app go directly to the tab bar controller, so the home screen is not launched. For that I need to have a segue. I forgot mention that. – angeldev Feb 02 '16 at 10:05
  • You should still load Home, but present the next VC in viewDidLoad of the HomeVC. Never segue in circles. – R Menke Feb 02 '16 at 12:07
  • @RMenke I can't find the way to "jump" login screen and present the next VC in viewDidLoad. Do you have any idea? – angeldev Feb 02 '16 at 13:52

0 Answers0