gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 12:19:35 25 4
gpt4 key购买 nike

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com