Skip to content

Commit

Permalink
fix/#363 이용약관 탭바이슈 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
hooni0918 committed Sep 5, 2024
1 parent aeeaf4e commit ebd5103
Showing 1 changed file with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import UIKit
import WebKit

import SnapKit

class MyPageTermsViewController: BaseViewController {

private let viewModel: MyPageViewModel
Expand All @@ -26,21 +28,46 @@ class MyPageTermsViewController: BaseViewController {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
view = UIView()
view.addSubview(webView)
}

override func viewDidLoad() {
super.viewDidLoad()

let myURL = URL(string: "https://arrow-frog-4b9.notion.site/a66033a3ff4a40bfaa6eff0a5bee737d")
let myRequest = URLRequest(url: myURL!)
webView.load(myRequest)
}

override func setupView() {
super.setupView()
setupNavigationBarTitle(with: "이용약관")
setupNavigationBarBackButton()

setupConstraints()

if let myURL = URL(string: "https://arrow-frog-4b9.notion.site/a66033a3ff4a40bfaa6eff0a5bee737d") {
let myRequest = URLRequest(url: myURL)
webView.load(myRequest)
}
}

private func setupConstraints() {
webView.snp.makeConstraints { make in
make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
make.leading.trailing.equalToSuperview()
make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom)
}
}

override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
adjustWebViewContentInset()
}

private func adjustWebViewContentInset() {
let contentInset = UIEdgeInsets(
top: 0,
left: 0,
bottom: view.safeAreaInsets.bottom + (tabBarController?.tabBar.frame.height ?? 0),
right: 0
)
webView.scrollView.contentInset = contentInset
webView.scrollView.scrollIndicatorInsets = contentInset
}
}

Expand Down

0 comments on commit ebd5103

Please sign in to comment.