I have a problem regarding swipe back gestures in swift. After I push the new uicollectionviewcontroller when certain cell is pressed at the parent uicollectionviewcontroller, I swipe back to the parent viewcontroller. But only a few navigationitems appear on the navigation bar. However, when I go back by pressing the "back" button, all the navigation items appear. Here's my code:
override func viewDidLoad() {
setupNavBarButtons()}
func setupNavBarButtons(){
let flexible = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.flexibleSpace, target: self, action: nil)
flexible.isEnabled = false
let logoImg = UIImage(named: "wee")?.withRenderingMode(.alwaysOriginal)
let homeBarButtonItem = UIBarButtonItem(image:logoImg, style: .plain, target: self, action: #selector(handleHome))
homeBarButtonItem.isEnabled = false
let cameraImg = UIImage(named: "nav bar_circles")?.withRenderingMode(.alwaysOriginal)
let cameraButtonItem = UIBarButtonItem(image:cameraImg, style: .plain, target: self, action: nil)
cameraButtonItem.isEnabled = false
navigationItem.rightBarButtonItems = [flexible, cameraButtonItem, flexible, cameraButtonItem, flexible, cameraButtonItem]
navigationItem.leftBarButtonItems = [flexible, cameraButtonItem, flexible, cameraButtonItem, flexible, cameraButtonItem, flexible, homeBarButtonItem]
navigationItem.accessibilityElementsHidden = false
navigationController?.hidesBarsOnSwipe = false
navigationController?.isNavigationBarHidden = false
}
func showAppDetailForApp(pht: UIImage){
let layout = UICollectionViewFlowLayout()
let detailLauncher = ShowPhoto(collectionViewLayout: layout)
detailLauncher.info = pht
navigationController?.navigationBar.barTintColor = UIColor.white
navigationController?.pushViewController(detailLauncher, animated: true)
}
Thanks in advance.