Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
f00b99e0
Commit
f00b99e0
authored
Apr 22, 2025
by
Alex朱枝文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决webvc释放问题
parent
6120059f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
YHH5WebViewVC.swift
.../Classes/Modules/InteractionH5(与H5交互)/YHH5WebViewVC.swift
+18
-13
No files found.
galaxy/galaxy/Classes/Modules/InteractionH5(与H5交互)/YHH5WebViewVC.swift
View file @
f00b99e0
...
...
@@ -37,20 +37,22 @@ class YHH5WebViewVC: YHBaseViewController, WKUIDelegate, WKNavigationDelegate {
config
.
allowsInlineMediaPlayback
=
true
/// 开启让自动播放
config
.
mediaTypesRequiringUserActionForPlayback
=
[]
let
webview
=
DWKWebView
(
frame
:
.
zero
,
configuration
:
config
)
webview
.
scrollView
.
contentInsetAdjustmentBehavior
=
.
never
webview
.
setDebugMode
(
false
)
// webview.uiD
elegate = self
let
view
=
DWKWebView
(
frame
:
.
zero
,
configuration
:
config
)
view
.
scrollView
.
contentInsetAdjustmentBehavior
=
.
never
// view.navigationDelegate = self
// view.scrollView.d
elegate = self
return
webview
view
.
setDebugMode
(
false
)
// webview.uiDelegate = self
return
view
}()
lazy
var
progBar
:
UIProgressView
=
{
let
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
let
view
=
UIProgressView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
self
.
view
.
frame
.
width
,
height
:
30
))
view
.
progress
=
0.0
view
.
tintColor
=
UIColor
.
brandMainColor
return
view
}()
var
url
=
""
...
...
@@ -75,8 +77,6 @@ class YHH5WebViewVC: YHBaseViewController, WKUIDelegate, WKNavigationDelegate {
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
setupUI
()
webview
.
navigationDelegate
=
self
webview
.
scrollView
.
delegate
=
self
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
keyboardWillShow(_:)
)
,
name
:
UIResponder
.
keyboardWillShowNotification
,
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
keyboardWillHide(_:)
)
,
...
...
@@ -84,6 +84,10 @@ class YHH5WebViewVC: YHBaseViewController, WKUIDelegate, WKNavigationDelegate {
}
deinit
{
if
webview
.
observationInfo
!=
nil
{
webview
.
removeObserver
(
self
,
forKeyPath
:
#keyPath(
WKWebView.estimatedProgress
)
)
webview
.
removeObserver
(
self
,
forKeyPath
:
#keyPath(
WKWebView.title
)
)
}
// webview.removeObserver(self, forKeyPath: "estimatedProgress")
// webview.removeObserver(self, forKeyPath: "title")
webview
.
navigationDelegate
=
nil
...
...
@@ -303,7 +307,8 @@ private extension YHH5WebViewVC {
}
gk_navigationBar
.
isHidden
=
isHideNavigationBar
webview
.
navigationDelegate
=
self
webview
.
scrollView
.
delegate
=
self
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
updateNetWorkUI
)
,
name
:
.
reachabilityChanged
,
object
:
nil
)
view
.
backgroundColor
=
.
white
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment