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

标签 swift uiwebview navbar

我有一个应用程序,在 Storyboard 上有一个 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 {



}

最佳答案

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

关于swift - ios如何防止键盘出现时导航栏隐藏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44959140/

相关文章:

ios - 快速从数组中删除自定义类型的元素

objective-c - 由于UIWebView,Apple拒绝了 objective-c AFNetworking

javascript - getBoundingClientRect 不返回大小信息 iOS8

ios - 在没有 cookie 的情况下打开 iOS web View

html - 折叠菜单中的一行社交图标

swift - 找不到 -lBolts 的库

arrays - 为什么Swift标准库中的reverse()函数会返回ReverseRandomAccessCollection?

ios - Swift 中的左对齐垂直 UILabel

javascript - 导航栏太宽

html - 如何修复白色背景。试图制作透明的导航栏