在第一个控制器中添加一个按钮
let shutDownBtn: UIButton!
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(true)
self.shutDownBtn.isHidden = true
}
override func viewWillAppear (_ animated: Bool) {
super.viewWillAppear(true)
shutDownBtn = UIButton.init()
shutDownBtn.setTitle("关闭",for: .normal)
shutDownBtn.setTitleColor(UIColor.black,for: .normal)
// shutDownBtn.setImage(UIImage.init(named: "compose_guide_icon_close_check"),for: .normal)
shutDownBtn.frame = CGRect(x: self.view.bounds.width - 120,y: 0,width: 40,height: 40)
shutDownBtn.addTarget(self,action: #selector(shutdown),for: .touchUpInside)
self.navigationController?.navigationBar.addSubview(shutDownBtn)
self.shutDownBtn.isHidden = false
}