Skip to content

Commit

Permalink
Merge pull request #370 from yjwyjwyjw/scroll
Browse files Browse the repository at this point in the history
[Feat] #303 산 상세 화면 스크롤 삭제
  • Loading branch information
yjwyjwyjw authored Dec 1, 2021
2 parents ed7f172 + 9320eaa commit fb6c6b3
Showing 1 changed file with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import MapKit
final class MountainDetailViewController: UIViewController {
weak var coordinator: MountainDetailViewCoordinator?
private var viewModel: MountainDetailViewModel?
private var mutatingTopConstraint: NSLayoutConstraint?
private let maxRollUpDistance: CGFloat = 50

private lazy var backButton: UIButton = {
let button = UIButton(frame: .zero)
Expand Down Expand Up @@ -76,19 +74,13 @@ extension MountainDetailViewController {
mapSnapShot.heightAnchor.constraint(equalTo: headerView.heightAnchor, multiplier: 0.85)
])

self.mutatingTopConstraint = titleView.topAnchor.constraint(equalTo: mapSnapShot.bottomAnchor)
NSLayoutConstraint.activate([
titleView.topAnchor.constraint(equalTo: mapSnapShot.bottomAnchor),
titleView.leftAnchor.constraint(equalTo: headerView.leftAnchor),
titleView.rightAnchor.constraint(equalTo: headerView.rightAnchor),
titleView.heightAnchor.constraint(equalToConstant: self.view.bounds.height * 0.07)
])

if let upperConstraint = self.mutatingTopConstraint {
NSLayoutConstraint.activate([
upperConstraint
])
}

NSLayoutConstraint.activate([
tableView.topAnchor.constraint(equalTo: titleView.bottomAnchor),
tableView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
Expand Down Expand Up @@ -214,16 +206,6 @@ extension MountainDetailViewController: UITableViewDelegate, UITableViewDataSour
}
}

extension MountainDetailViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let isBottom = scrollView.contentSize.height <= scrollView.bounds.height + scrollView.contentOffset.y
guard !isBottom else { return }
if scrollView.contentOffset.y > 0 && scrollView.contentOffset.y < self.maxRollUpDistance {
self.mutatingTopConstraint?.constant = -scrollView.contentOffset.y
}
}
}

extension MountainDetailViewController: MKMapViewDelegate {
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
guard let annotation = annotation as? MountainAnnotation else { return nil }
Expand Down

0 comments on commit fb6c6b3

Please sign in to comment.