Как я могу отключить анимацию перехода для прокрутки края в UINavigationController? - PullRequest
0 голосов
/ 04 июля 2019

Как убрать анимацию для UINavigationController? Я не нашел собственности в UINavigationController для этого. Является ли пользовательский класс только одним способом?

1 Ответ

0 голосов
/ 06 июля 2019

Вы можете сделать это на доске рассказов

enter image description here

В коде вы можете сделать это:

@IBAction private func nextTapped() {
    let storyBoard = UIStoryboard(name: "Main", bundle: nil)
    guard let otherViewController = storyBoard.instantiateViewController(withIdentifier: "OtherViewController") as? OtherViewController,
        let navigationController = navigationController  else {
        return
    }

    // when you push the view controller, pass in animated as false
    navigationController.pushViewController(otherViewController, animated: false)
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Next",
                                                        style: .plain,
                                                        target: self,
                                                        action: #selector(nextTapped))        
}
...