Skip to content

Commit

Permalink
[Feat] #319 - 상세 지도에 한끼 핀 띄우고 카메라 이동 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
EunsuSeo01 committed Dec 29, 2024
1 parent cc5e660 commit 9d96f06
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ final class DetailMapView: BaseView {
}

mapView.do {
$0.zoomLevel = 16
$0.clipsToBounds = true
$0.layer.cornerRadius = 12
$0.layer.maskedCorners = CACornerMask(arrayLiteral: .layerMinXMinYCorner, .layerMaxXMinYCorner)
Expand Down Expand Up @@ -130,6 +131,8 @@ extension DetailMapView {

func bindData(latitude: Double, longitude: Double) {
addressLabel.text = "\(latitude) \(longitude)"
addMapMarker(latitude: latitude, longitude: longitude)
moveMapCamera(latitude: latitude, longitude: longitude)
}
}

Expand All @@ -145,6 +148,18 @@ private extension DetailMapView {
UIPasteboard.general.string = addressLabel.text
}

func addMapMarker(latitude: Double, longitude: Double) {
let marker = NMFMarker()
marker.position = NMGLatLng(lat: latitude, lng: longitude)
marker.iconImage = NMFOverlayImage(image: .icPin)
marker.mapView = mapView
}

func moveMapCamera(latitude: Double, longitude: Double) {
let cameraUpdate = NMFCameraUpdate(scrollTo: NMGLatLng(lat: latitude, lng: longitude))
mapView.moveCamera(cameraUpdate)
}

// MARK: - @objc Func

@objc func copyButtonDidTap() {
Expand Down

0 comments on commit 9d96f06

Please sign in to comment.