Commit 304f6594 authored by David黄金龙's avatar David黄金龙

几处代码优化

parent 1f0551ff
......@@ -25,7 +25,7 @@ class YHResignGuidelinesExampleViewController: YHBaseViewController {
// var viewModel = YHResignCertificateListViewModel()
var viewModel = YHResignGuidelinesViewModel()
var height: CGFloat = 0
var id = 3473
var id : Int = -1
override func viewDidLoad() {
super.viewDidLoad()
......
......@@ -15,8 +15,22 @@ import Photos
快速测评 及 其他与H5交互的界面
*/
class YHH5WebViewVC: YHBaseViewController, WKUIDelegate, WKNavigationDelegate {
var webview = DWKWebView()
var progBar = UIProgressView()
lazy var webview : DWKWebView = {
let webview = DWKWebView(frame: .zero)
webview.scrollView.contentInsetAdjustmentBehavior = .never
webview.navigationDelegate = self
webview.scrollView.delegate = self
webview.setDebugMode(false)
return webview
}()
lazy var progBar : UIProgressView = {
progBar = UIProgressView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 30))
progBar.progress = 0.0
progBar.tintColor = UIColor.brandMainColor
return progBar
}()
var url = ""
var navTitle = "" //导航栏title
......@@ -167,11 +181,7 @@ private extension YHH5WebViewVC {
// 创建wkwebview
webview = DWKWebView(frame: .zero)
webview.scrollView.contentInsetAdjustmentBehavior = .never
webview.navigationDelegate = self
webview.scrollView.delegate = self
webview.setDebugMode(false)
let api = YHJsApi()
api.delegate = self
......@@ -216,14 +226,8 @@ private extension YHH5WebViewVC {
}
// }
// 加载网页的进度条
progBar = UIProgressView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 30))
progBar.progress = 0.0
progBar.tintColor = UIColor.brandMainColor
webview.addSubview(progBar)
// 监听网页加载的进度
webview.addObserver(self, forKeyPath: "estimatedProgress", options: .new, context: nil)
......
......@@ -59,9 +59,9 @@ extension YHJsApi {
}
//8、跳转案例分享UI
@objc func goCaseShareUISyn(_ caseId: String) {
@objc func goCaseShareUISyn(_ caseId: Any) {
DispatchQueue.main.async {
if let id = Int(caseId) {
if let sId = caseId as? String, let id = Int(sId) {
let vc = YHResignGuidelinesExampleViewController()
vc.id = id
self.delegate?.navigationController?.pushViewController(vc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment