1

I know this is an old issue and had been answered in objective C. But i am looking for solution in Swift. My code for splitviewController in AppDelegate is as follows.

func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController:UIViewController!, ontoPrimaryViewController primaryViewController:UIViewController!) -> Bool {
      if let secondaryAsNavController = secondaryViewController as? UINavigationController {
          if let topAsDetailController = secondaryAsNavController.topViewController as? DocumentsViewController {
              if topAsDetailController.tracksDocumentTableView == nil {
                  // Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
                  return true
              }
          }
      }
      return false
  }

i've got two views (MAster-Detail) as MasterViewController and DocumentViewConttoller. Is this a bug? or am i missing something? Thanks

Community
  • 1
  • 1
Sashi
  • 533
  • 3
  • 6
  • 21

1 Answers1

0

Your code looks pretty much like mine and mine is working fine. When you are checking

if topAsDetailController.tracksDocumentTableView == nil

are you setting the value of tracksDocumentTableView in prepareForSegue of the master view controller?

MirekE
  • 11,515
  • 5
  • 35
  • 28