2017-07-06 89 views
0

我有一個應用程序,其中有一個故事板上的webview,加載ASP註冊表單,所以當鍵盤或選擇器出現時,導航欄隱藏,但永不回來,所以我不能回到最後一頁。如何防止鍵盤出現ios時導航欄隱藏?

這裏是我的代碼:

import UIKit 

class BannerViewController: UIViewController { 

    @IBOutlet var webView11: UIWebView! 

    override var preferredStatusBarStyle: UIStatusBarStyle { 
     return .default 
    } 

    override var prefersStatusBarHidden: Bool { 
     return false 
    } 

    override func viewWillAppear(_ animated: Bool) { 
     self.navigationItem.setHidesBackButton(false, animated: true) 
     self.setNeedsStatusBarAppearanceUpdate() 


     self.navigationController?.navigationBar.barTintColor = UIColor(red: 0, green: 0.38, blue: 0.667, alpha: 1) 
     self.navigationController?.navigationBar.tintColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1) 
     var titleTextAttributes = [String : AnyObject](); 
     titleTextAttributes[NSFontAttributeName] = UIFont.systemFont(ofSize: 17, weight: UIFontWeightSemibold) 
     titleTextAttributes[NSForegroundColorAttributeName] = UIColor(red: 1, green: 1, blue: 1, alpha: 1) 
     self.navigationController?.navigationBar.titleTextAttributes = titleTextAttributes 
    } 

    override func viewDidLoad() { 
     super.viewDidLoad(); 
     self.navigationController?.navigationBar.barStyle = .default 
     self.setNeedsStatusBarAppearanceUpdate() 
    self.navigationController?.setNavigationBarHidden(false, animated: true) 

     self.webView11.delegate = self; 
     if let unwrappedwebView11 = URL(string: "http://www.stackoverflow") { 
      self.webView11.loadRequest(URLRequest(url: unwrappedwebView11)) 
     } 
    } 



} 


extension BannerViewController: UIWebViewDelegate { 



} 

回答

0

所以,它看起來像我需要刷新視圖或東西,因爲我加入了web視圖的後退按鈕,當我點擊並返回到最後一個視圖,然後我再次進入webView navBar不再移動