Правая кнопка NavigationBar не появляется - PullRequest
0 голосов
/ 03 марта 2020

Я назначил пользовательский класс на панель навигации, но правая кнопка не отображается на панели навигации. Вот код, если кто-то может помочь будет оценен.

class BaseNavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationBar.tintColor = UIColor.white
        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
        navigationItem.leftBarButtonItem?.tintColor = UIColor.white
        navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "contact_us"), style: .plain, target: self, action: #selector(callSupport))
        self.navigationBar.barTintColor = UIColor(hexString: "#37C54D")
        self.navigationBar.isTranslucent = true

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @objc func callSupport() {
        print("Button Pressed")
    }

}

1 Ответ

0 голосов
/ 03 марта 2020

@ Мухаммед Хасан Иршад
BaseViewController: BaseViewController.

Пример ViewController:
A sample ViewController.

...