Am trying to use splitviewcontroller for the first time. I have multiple detail views one being normal UIViewcontroller and the other UICollectionViewcontroller . When am trying to navigate to UICollectionViewController on click of a row under RootViewController the methods (cellForItemAt, numberOfSections, numberOfItemsInSecrtion)in my UICollectionViewController does not get invoked .
Am navigating to my UICollectionViewController using the below code. Please let me know the correct way .
func openDocumentsViewController(){ self.splitViewController?.preferredDisplayMode = .automatic
let viewcontroller:DocumentViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "DocumentsViewController") as! DocumentViewController
let navigationController = UINavigationController(rootViewController: viewcontroller)
self.splitViewController?.showDetailViewController(navigationController, sender: self)
}
Okay , I forgot to set the delegate and datasource for collectionView . This fixed the problem !!