title: Reset viewcontroller on UINavigation Back
body: <p><strong>TL;DR:</strong></p>
  
  <p><em>How can I fully recreate/reset a view controller that I'm navigating back to from the automatically placed UINavigationController back button?</em></p>
  
  <ul>
  <li><p>OldVC &lt;- CurrentVC</p></li>
  <li><p>Ensure OldVC is completely reset.</p></li>
  </ul>
  
  <p>Hi guys,</p>
  
  <p>I'm using UINavigation and the automatically generated back button. When a user presses the back button, I want the previous view controller in the navigation stack to be fully reinstantiated - similar to how you would create the view controller then push to it.</p>
  
  <p>I've tried the following but have been unable to find a solution:</p>
  
  <ul>
  <li><p>on view will load of the target VC, <code>self.view.setNeedsDisplay()</code> - doesn't recreate</p></li>
  <li><p>manually dropping the old VC from the stack and inserting a fresh one in it's place</p></li>
  <li><p>dismissing the VC - when leaving the main VC to the new VC, calling <code>self.dismissViewControllerAnimated(true, completion: nil)
  </code> doesn't drop the old VC from the stack</p></li>
  </ul>
  
  <p>I have a temporary solution in place now using the following code, however from a UX perspective it is not right, as it relies on a custom button and an illogical animation from the push that makes the user think they are going further into the app rather than coming out, the code is below and recreates the VC fully (as you can see from the instantiation).</p>
  
  <pre><code>private func goToStoryBoard(name: String) {
      let storyboard = UIStoryboard(name: "Main", bundle: nil)
      let vc = storyboard.instantiateViewControllerWithIdentifier(name)
      self.navigationController?.pushViewController(vc, animated: true)
  
  }
  </code></pre>
  
  <p>UPDATE</p>
  
  <p>It looks like the issue is with the way I am creating custom components - I initialise them once like below, but by doing it this way they will not update:</p>
  
  <pre><code>  class HomeMenuButton: UIButton { 
             required init?(coder aDecoder: NSCoder) { 
                super.init(coder: aDecoder)                                
                self.setTitleColor(InterfaceColors.MainFont, forState: .Normal) 
                self.titleLabel?.font = InterfaceFonts.ButtonFont 
        } 
  }
  </code></pre>