Skip to content

Commit

Permalink
[Feat] #303 산 상세 화면 스크롤 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiwon Yoon authored and Jiwon Yoon committed Dec 1, 2021
1 parent 63a42e5 commit 9320eaa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA4736EF27561C6200841326"
BuildableName = "MountainListSceneTestss.xctest"
BuildableName = "MountainListSceneTests.xctest"
BlueprintName = "MountainListSceneTests"
ReferencedContainer = "container:SanTa.xcodeproj">
</BuildableReference>
Expand Down
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 9320eaa

Please sign in to comment.