title: Uiwebview hide/show UInavigationbar with Swift
body: <p>I'm trying to implement a very simple UIWebView that uses a UINavigationBar for navigation in Swift.  I'm new to IOS programming and have spent a lot of time trying proposed solutions, but I'm completely stuck.  The storyboard looks like:</p>
  
  <p>->View</p>
  
  <p>->->Navigation Bar</p>
  
  <p>->->Web View</p>
  
  <p>The navigation bar is only there to go back in the web view when I'm not on the main page.  I'm trying to autohide the navigation bar on the main page of the webview with a snippet like that below.  However when I try to resize the web view with <code>self.Webview.frame = self.view.bounds</code> it shows up overlapping the very top of the page where the carrier and battery icons are.  If I don't do the resize I get a blank space where the UINavigationBar gets hidden.  </p>
  
  <pre><code>func webViewDidFinishLoad(webView: UIWebView) {
      let currentUrl : NSString = (Webview.request?.URL!.absoluteString)!
      var currentUrlString = currentUrl as String
      if currentUrlString.rangeOfString("index.html") != nil {
          //HIDE THE NAVIGATION BAR
          myNavigationBar.hidden=true
          //ADJUST THE WEBVIEW SIZE TO ACCOUNT FOR THE HIDDEN BAR
          self.Webview.frame = self.view.bounds
      } else {
          myNavigationBar.hidden=false
          Webview.frame = self.view.bounds
      }
  }
  </code></pre>