Post

Replies

Boosts

Views

Activity

UISplitViewController in iOS 14 works as intended in landscape mode, but not in portrait
I am trying to preserve the functionality of iOS 13 and UISplitViewController in my app for iOS 14. Everything works as intended (two side by side view controllers) in landscape mode, but if I launch the app (the split view controller is the initial view controller) in portrait, my conditional logic to show the primary view controller when a variable in the detail view controller is nil is not functioning properly AND the navigation bar (bar button items, large titles) for the primary and detail view controller is not visible.  func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool  {                  if (secondaryViewController is UINavigationController) && (((secondaryViewController as? UINavigationController)?.topViewController) is DetailViewController) && (((secondaryViewController as? UINavigationController)?.topViewController as? DetailViewController)?.dict == nil) {             return true         } else {             return false         }     } Strangely enough, if I launch the app in landscape and then move to portrait, the titles are there, the bars are there, and everything works as intended. This seems to be an issue with first launch in portrait mode.
2
0
1.7k
Aug ’20