I am trying to have a navigation controller with different preferlargetitles
booleans on my main page and another storyboard. When I start the simulation it lands on the main page with large title true
. Then I tap on a collection view cell to view a pdf and I have the large title set to false for that view controller (or so I believe). When I press the back button on the nav controller to the main page, the large title is now set to false.
I have tried to set the large title to true in the collectionview
viewDidLoad
but nothing.
Code for the main page on going to the pdf view controller:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let selectedRow = indexPath.row
if selectedRow == 0 {
print("add button selected")
return
}
else {
let document = Data.documentModel[selectedRow - 1]
let storyboard = UIStoryboard(name: String(describing: NoteTakingViewController.self), bundle: nil)
let vc = storyboard.instantiateInitialViewController() as! NoteTakingViewController
vc.document = document
//self.present(vc, animated: true, completion: nil)
self.show(vc, sender: selectedRow)
}
Code for inside the pdf view controller after you tap on a file from the main page:
override func viewDidLoad() {
super.viewDidLoad()
....(to view the pdf code went here)
self.title = document.title
navigationController?.navigationBar.prefersLargeTitles = false
// Do any additional setup after loading the view.
}
When I go to the storyboard I get the small title but it carries over to the main page.