Добрый вечер. Подскажите, какой метод можно использовать, чтобы обратиться к возвращающей кнопке?
P.S. Нужно при нажатии на возвращающую кнопку проверять данные.
Спасибо!
backButton в Navigation
Silea
#1
soledue
#3
you have to use your own function, like this:
func viewDidLoad {
super.viewDidLoad()
self.navigationItem.hidesBackButton = true
let newBackButton = UIBarButtonItem(title: "Back", style: UIBarButtonItemStyle.plain, target: self, action: #selector(YourViewController.back(sender:)))
self.navigationItem.leftBarButtonItem = newBackButton
}
func back(sender: UIBarButtonItem) {
// Perform your custom actions
// ...
// Go back to the previous ViewController
_ = navigationController?.popViewController(animated: true)
}
Silea
#4
Если я правильно понимаю, то в Вашем коде кнопка создаётся, а мне нужна та, которая уже имеется (как полагаю).
soledue
#5
I am sorry, but it’s impossible di take the action of UIBarButton, the only way is create another.