I'm using a custom TabViewController. I want to change the right bar button item ONLY in CompanyViewController. However, changing the self.navigationItem.rightBarButtonItem
doesn't work - the button doesn't show up on the navigation bar. How can I fix this?
CompanyViewController.swift
let filterButton = UIBarButtonItem(title: "Filters Off", style: .plain, target: self, action: #selector(filterButtonTapped))
self.navigationController?.navigationBar.topItem?.rightBarButtonItem = filterButton // Works
self.navigationItem.rightBarButtonItem = filterButton //Doesn't work