I wish to remove the back button from my view controller.
My ViewController also has a scroll view attached to it.
So far I have added the following code to my viewDidLoad():
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.leftBarButtonItem = nil;
self.navigationItem.hidesBackButton = true;
self.navigationController?.navigationItem.backBarButtonItem?.isEnabled = false;
self.navigationController!.interactivePopGestureRecognizer!.isEnabled = false;
self.navigationItem.setHidesBackButton(true, animated:true);
// Do any additional setup after loading the view.
}
However even after running the program with this added code, the back button still does not go away for some reason. I would like to know how I would go about removing the back button.
Much appreciated
尝试这个:
self.navigationItem.setHidesBackButton(true, animated: false)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.