Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

self?.performSegue is not showing navigation bar

self?.performSegue(withIdentifier: "myview", sender: nil)

Above code do not show the navigation bar even though I use push in storyboard. Below code is shows me an error, even though the segue with correct name exist

self?.navigationController?.performSegue(withIdentifier: "myview", sender: nil)

Error

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'myview''

like image 938
cole Avatar asked Jan 03 '23 14:01

cole


1 Answers

Your navigation bar might be hidden, try adding this code in viewcontroller which get called by the segue

override func viewWillAppear(_ animated: Bool) {
    self.navigationController?.setNavigationBarHidden(false, animated: true)
}

Note: Please check the viewController pushing the segue with "myView" is embeded in UINavigationController .

like image 135
Preeti Rani Avatar answered Jan 06 '23 04:01

Preeti Rani