当键盘出现ios时如何防止导航栏隐藏?

时间:2017-07-06 21:26:36

标签: swift uiwebview navbar

我有一个应用程序,它在故事板上有一个webview,它在ASP中加载一个注册表单,所以当键盘或选择器出现时,导航栏会隐藏,但永远不会回来,所以我无法回到最后一页。

这是我的代码:

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 {



}

1 个答案:

答案 0 :(得分:0)

所以,看起来我需要刷新视图或其他东西,因为我在webView中添加了一个后退按钮,当我点击并返回上一个视图,然后我再次进入webView导航栏没有再动了