你好,我是在視圖控制器B帶其導航欄,按鈕,在視圖控制器乙按去的ViewController C(我不想在導航欄的viewController C)Segue公司回來導航欄
let vc = self.storyboard?.instantiateViewController(withIdentifier: "viewC") as! ViewcontrollerC
vc.passAction = "saveedit"
vc.passName = passName
self.present(vc, animated: true, completion: nil)
當我點擊保存按鈕在ViewcontrollerC我應該回去ViewcontrollerB與ViewcontrollerB導航欄
let vc = self.storyboard?.instantiateViewController(withIdentifier: "viewB") as! ViewcontrollerB
vc.passName = "\(firstNameTxt.text!)\(" ")\(lastNameTxt.text!)"
self.present(vc, animated: false, completion: nil)
這裏的問題是,當我回到ViewcontrollerB我沒有看到導航欄那裏。
EDITED
class ViewcontrollerB : UpdateDataDelegate {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated);
self.navigationController?.isNavigationBarHidden = false
}
@IBAction func click_edit(_ sender: Any) {
let vc = self.storyboard?.instantiateViewController(withIdentifier: "patientPersonalData") as! patientPersonalDataVC
vc.passName = passName
vc.passAction = "saveedit"
self.navigationController?.pushViewController(vc, animated: true)
}
func loadData() {
}
}
// ViewcontrollerC
protocol UpdateDataDelegate {
func loadData()
}
class Viewcontroller C {
var delegate: UpdateDataDelegate?
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.isNavigationBarHidden = true
}
fun click_save() {
self.navigationController?.popViewController(animated: true)
self.delegate?.loadData()
}
}
你嵌入您的視圖 - 控制與導航控制器 –
@ Anbu.Karthik是的,在故事板與導航控制器 – swiftuser123