title: Navigation Controller. Background color
body: <p>For one controller I have settings:</p>
  
  <pre><code>self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
  self.navigationController?.navigationBar.shadowImage = UIImage()
  </code></pre>
  
  <p>and</p>
  
  <pre><code>override func scrollViewDidScroll(_ scrollView: UIScrollView) {
          var offset = scrollView.contentOffset.y / 150
          if offset &gt; 1 {
              offset = 1
              self.navigationController?.navigationBar.backgroundColor = UIColor(red: 82/255, green: 76/255, blue: 70/255, alpha: offset)
              UIApplication.shared.statusBarView?.backgroundColor = UIColor(red: 82/255, green: 76/255, blue: 70/255, alpha: offset)
              self.navigationItem.title = name
          } else {
              self.navigationController?.navigationBar.backgroundColor = UIColor(red: 82/255, green: 76/255, blue: 70/255, alpha: offset)
               UIApplication.shared.statusBarView?.backgroundColor = UIColor(red: 82/255, green: 76/255, blue: 70/255, alpha: offset)
              self.navigationItem.title = ""
          }
      }
  </code></pre>
  
  <p>The main problem is that when i press back button, settings save. In the end i have white NavigationController. How can I make the settings not taken from the last controller?</p>
  
  <pre><code>func makeSearchController() {
          searchController = UISearchController(searchResultsController: nil)
          navigationItem.searchController = searchController
          navigationItem.hidesSearchBarWhenScrolling = false
          searchController.searchResultsUpdater = self
          searchController.dimsBackgroundDuringPresentation = false
          searchController.searchBar.tintColor = .white
          searchController.searchBar.placeholder = "Блюдо или продукт ..."
      }
  </code></pre>