title: Where I should put code to customize Cancel button in UISearchBar?
body: <p>I trying to change Cancel button color in UISearchBar implemented with UISearchController (iOS 8 and greater). This is a code I use:</p>
  
  <pre><code>if self.resultSearchController.active {
          for subView in self.resultSearchController.searchBar.subviews  {
              for subsubView in subView.subviews  {
                  if subsubView.isKindOfClass(UIButton) {
                      subsubView.tintColor =  UIColor.whiteColor()
                  }
              }
          }
      }
  </code></pre>
  
  <p>If I paste it in viewDidLoad, it doesn't work, cause I think Cancel button initialize only when SearchController becomes Active.</p>
  
  <p>If I paste code in viewDidLayoutSubviews everything work great, but I'm not sure its a correct way.</p>
  
  <p>So, where I should put this code in TableViewController?</p>
  
  <p>Also, I don't understand, how  I can receive notification in my TableViewController that SearchController becomes inactive. In other words where I should put code like this:</p>
  
  <pre><code>if self.resultSearchController.active == false {
     //Do something 
  }
  </code></pre>