--- title: "iOS 2.x → 3.x 마이그레이션" slug: "naveropenapiv3-maps-ios-sdk-v3-migration" tags: ["Mobile Dynamic Map"] updated: 2026-08-20T09:03:13Z published: 2026-08-20T09:03:13Z canonical: "guide-gov.ncloud-docs.com/naveropenapiv3-maps-ios-sdk-v3-migration" --- > ## Documentation Index > Fetch the complete documentation index at: https://guide-gov.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # iOS 2.x → 3.x 마이그레이션 Classic/VPC 환경에서 이용 가능합니다. 이 문서는 네이버 지도 iOS SDK 버전 2.x를 [버전 3.x](/docs/naveropenapiv3-maps-ios-sdk-v3-start)로 마이그레이션하는 방법을 설명합니다. ## 더 이상 제공되지 않는 기능 다음 기능은 3.x SDK에 포함되어 제공되지 않으므로 별도로 제공되는 대체 수단을 사용해 앱에서 구현해야 합니다. ### 좌표-주소 변환 기능 3.x SDK는 2.x SDK에서 `NMapReverseGeocoder.findPlacemarkAtLocation:`을 호출해 사용할 수 있었던 좌표-주소 변환(Reverse geocoding) 기능을 제공하지 않습니다. 대신 NAVER Cloud Platform에서 제공하는 Reverse Geocoding API를 사용할 수 있습니다. 자세한 내용은 [Reverse Geocoding](/docs/naveropenapiv3-maps-reverse-geocoding-reverse-geocoding)을 참고하세요. ### "네이버 지도앱 실행" 버튼 3.x SDK는 2.x SDK에서 `NMapView.setBuiltInAppControl:`를 호출해 활성화할 수 있었던 "네이버 지도앱 실행" 버튼을 제공하지 않습니다. 대신 앱에서 직접 버튼을 배치하고 NAVER Cloud Platform에서 제공하는 지도앱 연동 URL Scheme 기능을 사용할 수 있습니다. 자세한 내용은 [지도앱 연동 URL Scheme](/docs/naveropenapiv3-maps-url-scheme-url-scheme)을 참고하세요. ### 마커 드래그 3.x SDK는 2.x SDK에서 `NMapPOIitem.setPOIflagMode:`를 호출해 사용할 수 있었던 마커 드래그 기능을 제공하지 않습니다. 마커를 드래그하는 대신 화면의 중심에 마커 역할을 하는 뷰를 고정하고 지도를 움직여 위치를 지정하는 것을 권장합니다. 자세한 내용은 데모 앱의 [CameraEventViewController](https://github.com/navermaps/ios-map-sdk/blob/master/NaverMapDemo/CameraEventViewController.swift) 예제를 참고하세요. ## 환경 설정 ### 의존성 추가 3.x SDK의 라이브러리는 [cocoapods](https://cocoapods.org)를 통해 배포됩니다. 기존 2.x SDK `NMapViewerSDK.framework`와 `ApiGatewayMac.framework`를 프로젝트에서 삭제한 후 `Podfile`을 작성하고 `pod install`을 실행하여 framework를 추가합니다. 아래는 `Podfile`의 예제입니다. ``` platform :ios, '9.0' use_frameworks! target 'MyApp' do pod 'NMapsMap' end ``` 자세한 내용은 [시작하기](https://navermaps.github.io/ios-map-sdk/guide-ko/1.html) 문서의 [의존성 추가](https://navermaps.github.io/ios-map-sdk/guide-ko/1.html#%EC%9D%98%EC%A1%B4%EC%84%B1-%EC%B6%94%EA%B0%80) 절을 참고하세요. ### 클라이언트 ID 지정 3.x SDK는 `NMapView.setClientId:`를 호출하는 대신 [info.plist](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html)에 `NMFClientId`를 키값으로 지정하거나 [NMFAuthManager.clientId](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFAuthManager.html) 속성에 클라이언트 ID를 지정합니다. 다음은 클라이언트 ID를 지정하는 예제입니다. #### 2.x ``` - (void)viewDidLoad { [super viewDidLoad]; [self.mapView setClientId:@"YOUR_CLIENT_ID_HERE"]; } ``` #### 3.x ``` - (void)viewDidLoad { [super viewDidLoad]; [NMFAuthManager shared].clientId = @"YOUR_CLIENT_ID_HERE"; } ``` 자세한 내용은 [시작하기](https://navermaps.github.io/ios-map-sdk/guide-ko/1.html) 문서의 [클라이언트 ID 지정](https://navermaps.github.io/ios-map-sdk/guide-ko/1.html#%ED%81%B4%EB%9D%BC%EC%9D%B4%EC%96%B8%ED%8A%B8-id-%EC%A7%80%EC%A0%95) 절을 참고하세요. ## 지도 객체 ### 지도 표시 3.x SDK는 [NMFNaverMapView](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFNaverMapView.html) 또는 [NMFMapView](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFMapView.html)가 `NMapView`를 대신해 지도에 대한 뷰 역할을 합니다. 다음은 지도를 서브뷰로 추가하여 화면에 나타내는 예제입니다. #### 2.x ``` NMapView *mapView = [[NMapView alloc] initWithFrame:self.view.frame]; [mapView setReverseGeocoderDelegate:self]; [mapView setDelegate:self]; [self.view addSubview:mapView]; ``` #### 3.x ``` NMFMapView *mapView = [[NMFMapView alloc] initWithFrame:self.view.frame]; mapView.delegate = self; [self.view addSubView:mapView]; ``` 자세한 내용은 [지도 객체](https://navermaps.github.io/ios-map-sdk/guide-ko/2-1.html) 문서를 참고하세요. ### 좌표 3.x SDK는 [NMGLatLng](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMGLatLng.html)가 `NGeoPoint`를 대신해 좌표를 나타냅니다. `NMGLatLng`와 `NGeoPoint`는 생성자 파라미터의 경위도 순서가 반대이므로 주의해야 합니다. 다음은 좌표 객체를 생성하고 콘솔에 위도와 경도를 출력하는 예제입니다. #### 2.x ``` NGeoPoint coord = NGeoPointMake(126.9783740, 37.5670135); // 경도, 위도순 NSLog(@"위도: %f, 경도: %f", coord.latitude ,coord.longitude); ``` #### 3.x ``` NMGLatLng *coord = NMGLatLngMake(37.5670135, 126.9783740); // 위도, 경도순 NSLog(@"위도: %f, 경도: %f", coord.lat ,coord.lng); ``` 자세한 내용은 [좌표 객체](https://navermaps.github.io/ios-map-sdk/guide-ko/2-2.html) 문서의 [LatLng](https://navermaps.github.io/ios-map-sdk/guide-ko/2-2.html#latlng) 절을 참고하세요. ### 지도 유형 지정 지도의 유형을 지정하려면 `NMapController.setMapViewMode:` 대신 [NMFMapView.mapType](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFMapView.html#/c%3Aobjc%28cs%29NMFMapView%28py%29mapType) 속성을 지정합니다. 다음은 지도의 유형을 하이브리드로 지정하는 예제입니다. #### 2.x ``` [self.mapView setMapViewMode:NMapViewModeHybrid]; ``` #### 3.x ``` self.mapView.mapType = NMFMapTypeHybrid; ``` 자세한 내용은 [지도 옵션](https://navermaps.github.io/ios-map-sdk/guide-ko/2-3.html) 문서의 [지도 유형](https://navermaps.github.io/ios-map-sdk/guide-ko/2-3.html#%EC%A7%80%EB%8F%84-%EC%9C%A0%ED%98%95) 절을 참고하세요. ### 레이어 그룹 지정 특정 레이어 그룹을 활성화하려면 `NMapController.setMapViewTrafficMode:`, `NMapController.setMapViewBicycleMode:`와 같은 개별 메서드 대신 [NMFMapView.setLayerGroup:isEnabled:](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFMapView.html#/c%3Aobjc%28cs%29NMFMapView%28im%29setLayerGroup%3AisEnabled%3A)를 호출합니다. 다음은 실시간 교통정보, 자전거 레이어 그룹을 활성화하는 예제입니다. #### 2.x ``` [self.mapView setMapViewTrafficMode:YES]; [self.mapView setMapViewBicycleMode:YES]; ``` #### 3.x ``` [self.mapView setLayerGroup:NMF_LAYER_GROUP_TRAFFIC isEnabled:YES]; [self.mapView setLayerGroup:NMF_LAYER_GROUP_BICYCLE isEnabled:YES]; ``` 자세한 내용은 [지도 옵션](https://navermaps.github.io/ios-map-sdk/guide-ko/2-3.html) 문서의 [레이어 그룹](https://navermaps.github.io/ios-map-sdk/guide-ko/2-3.html#%EB%A0%88%EC%9D%B4%EC%96%B4-%EA%B7%B8%EB%A3%B9) 절을 참고하세요. ## 카메라와 투영 ### 카메라의 위치 3.x SDK는 2.x SDK와 다른 줌 레벨 체계를 사용합니다. 동일한 축척일 때 3.x SDK의 줌 레벨이 2.x SDK보다 4 정도 큽니다. 또한 줌 레벨의 타입이 `int`에서 `double`로 변경되었습니다. 3.x SDK는 좌표, 줌 레벨 등 카메라와 관련된 값을 낱개로 사용하는 2.x SDK와 달리 이러한 값을 묶은 [NMFCameraPosition](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFCameraPosition.html) 클래스를 사용합니다. 자세한 내용은 [카메라와 투영](https://navermaps.github.io/ios-map-sdk/guide-ko/3-1.html) 문서의 [카메라의 위치](https://navermaps.github.io/ios-map-sdk/guide-ko/3-1.html#%EC%B9%B4%EB%A9%94%EB%9D%BC%EC%9D%98%20%EC%9C%84%EC%B9%98) 절을 참고하세요. ### 카메라의 현재 위치 카메라의 현재 위치를 얻어오려면 `NMapController.mapCenter` 및 `NMapController.zoomLevel` 속성 대신 [NMFMapView.cameraPosition](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFMapView.html#/c%3Aobjc%28cs%29NMFMapView%28py%29cameraPosition)을 호출합니다. 다음은 카메라의 현재 위치를 얻고 콘솔에 각 속성을 출력하는 예제입니다. #### 2.x ``` NGeoPoint center = self.mapView.mapCenter; int zoom = self.mapView.zoomLevel; NSLog(@"중심 위도: %f, 중심 경도: %f, 줌 레벨: %d", center.latitude, center.longitude, zoom); ``` #### 3.x ``` NMFCameraPosition *cameraPosition = self.mapView.cameraPosition; NSLog(@"대상 지점 위도: %f, 대상 지점 경도: %f, 줌 레벨: %f, 기울임 각도: %f, 헤딩 각도: %f", cameraPosition.target.lat, cameraPosition.target.lng, cameraPosition.zoom, cameraPosition.tilt, cameraPosition.heading); ``` 자세한 내용은 [카메라와 투영](https://navermaps.github.io/ios-map-sdk/guide-ko/3-1.html) 문서의 [카메라의 현재 위치](https://navermaps.github.io/ios-map-sdk/guide-ko/3-1.html#%EC%B9%B4%EB%A9%94%EB%9D%BC%EC%9D%98-%ED%98%84%EC%9E%AC-%EC%9C%84%EC%B9%98) 절을 참고하세요. ### 카메라 이동 카메라를 이동하려면 `NMapController.setMapCenter:`를 호출하는 대신 [NMFCameraUpdate](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFCameraUpdate.html) 객체를 생성해 [NMFMapView.moveCamera:](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFMapView.html#/c%3Aobjc%28cs%29NMFMapView%28im%29moveCamera%3A)를 호출합니다. 다음은 카메라의 대상 좌표를 `(37.5666102, 126.9783881)` 지점으로, 줌 레벨을 15(2.x SDK 기준 11)로 변경하는 예제입니다. #### 2.x ``` [self.mapView setMapCenter:NGeoPointMake(126.9783881, 37.5666102) atLevel: 11]; ``` #### 3.x ``` NMFCameraUpdate *cameraUpdate = [NMFCameraUpdate cameraUpdateWithScrollTo: NMGLatLngMake((37.5666102, 126.9783881) zoomTo:15]; [self.mapView moveCamera:cameraUpdate]; ``` 자세한 내용은 [카메라 이동](https://navermaps.github.io/ios-map-sdk/guide-ko/3-2.html) 문서의 [API 호출로 카메라 이동하기](https://navermaps.github.io/ios-map-sdk/guide-ko/3-2.html#api-%ED%98%B8%EC%B6%9C%EB%A1%9C-%EC%B9%B4%EB%A9%94%EB%9D%BC-%EC%9D%B4%EB%8F%99%ED%95%98%EA%B8%B0) 절을 참고하세요. ### 카메라 변경 이벤트 카메라 변경 이벤트를 받으려면 `NMapView.delegate` 속성과 동일하게 [NMFMapView.delegate](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFMapView.html#/c%3Aobjc%28cs%29NMFMapView%28py%29delegate) 속성을 지정하고 해당 콜백 메서드를 구현합니다. 다음은 카메라 변경 이벤트를 받아 변경된 위치를 로깅하는 예제입니다. #### 2.x ``` - (void)viewDidLoad { [super viewDidLoad]; self.mapView.delegate = self; // 현재 뷰 컨트롤러가 콜백 이벤트를 받도록 지정 } - (void) onMapView:(NMapView *)mapView didChangeMapLevel:(int)level { NSLog(@"줌 레벨 변경: %d", level); } - (void) onMapView:(NMapView *)mapView didChangeMapCenter:(NGeoPoint)location { NSLog(@"중심 변경 - 위도: %f, 경도: %f", location.longitude, location.latitude); } ``` #### 3.x ``` - (void)viewDidLoad { [super viewDidLoad]; self.mapView.delegate = self; // 현재 뷰 컨트롤러가 콜백 이벤트를 받도록 지정 } - (void)mapView:(nonnull NMFMapView *)mapView regionDidChangeAnimated:(BOOL)animated byReason:(NSInteger)reason { NMFCameraPosition *cameraPosition = mapView.cameraPosition; NSLog(@"카메라 변경 - 대상 지점 위도: %f, 대상 지점 경도: %f, 줌 레벨: %f, 기울임 각도: %f, 헤딩 각도: %f", cameraPosition.target.lat, cameraPosition.target.lng, cameraPosition.zoom, cameraPosition.tilt, cameraPosition.heading); } ``` 자세한 내용은 [카메라 이동](https://navermaps.github.io/ios-map-sdk/guide-ko/3-2.html) 문서의 [카메라 변경 이벤트](https://navermaps.github.io/ios-map-sdk/guide-ko/3-2.html#%EC%B9%B4%EB%A9%94%EB%9D%BC-%EB%B3%80%EA%B2%BD-%EC%9D%B4%EB%B2%A4%ED%8A%B8) 절을 참고하세요. ### 투영 화면 좌표와 지도 좌표를 상호 변환하려면 `NMapProjection` 대신 [NMFProjection](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFProjection.html) 클래스를 사용합니다. [NMFMapView.projection](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFMapView.html#/c%3Aobjc%28cs%29NMFMapView%28py%29projection) 속성으로 받아올 수 있습니다. 화면 좌표를 지도 좌표로 변환하려면 `NMapProjection.fromPoint:` 대신 [NMFProjection.latlngFromPoint:](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFProjection.html#/c%3Aobjc%28cs%29NMFProjection%28im%29latlngFromPoint%3A)를, 지도 좌표를 화면 좌표로 변환하려면 `NMapProjection.toPointFromLocation:` 대신 [NMFProjection.pointFromLatLng:](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFProjection.html#/c%3Aobjc%28cs%29NMFProjection%28im%29pointFromLatLng:)를 호출합니다. 다음은 화면의 `(100, 100)` 지점을 지도 좌표로 변환하는 예제입니다. #### 2.x ``` NGeoPoint coord = [self.mapView fromPoint:CGPointMake(100, 100)]; ``` #### 3.x ``` NMGLatLng *coord = [self.mapView.projection latlngFromPoint:CGPointMake(100, 100)]; ``` 다음은 지도의 `(37.5666102, 126.9783881)` 지점을 화면 좌표로 변환하는 예제입니다. #### 2.x ``` CGPoint point = [self.mapView toPointFromLocation:NGeoPointMake(126.9783881, 37.5666102)]; ``` #### 3.x ``` CGPoint point = [self.mapView.projection pointFromLatLng:NMGLatLngMake(37.5666102, 126.9783881)]; ``` 자세한 내용은 [카메라와 투영](https://navermaps.github.io/ios-map-sdk/guide-ko/3-1.html) 문서의 [화면 좌표와 지도 좌표 간 변환](https://navermaps.github.io/ios-map-sdk/guide-ko/3-1.html#%ED%99%94%EB%A9%B4-%EC%A2%8C%ED%91%9C%EC%99%80-%EC%A7%80%EB%8F%84-%EC%A2%8C%ED%91%9C-%EA%B0%84-%EB%B3%80%ED%99%98) 절을 참고하세요. ## 상호작용 ### 컨트롤 3.x SDK에는 줌 컨트롤을 비롯한 여러 가지 컨트롤이 내장되어 있습니다. 줌 컨트롤은 기본적으로 활성화되며, 비활성화하려면 [NMFNaverMapView.showZoomControls](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFNaverMapView.html#/c%3Aobjc%28cs%29NMFNaverMapView%28py%29showZoomControls)를 호출합니다. #### 2.x ``` // 지원하지 않음 ``` #### 3.x ``` self.naverMapView.showZoomControls = YES; ``` 자세한 내용은 [사용자 인터페이스](https://navermaps.github.io/ios-map-sdk/guide-ko/4-1.html) 문서의 [컨트롤](https://navermaps.github.io/ios-map-sdk/guide-ko/4-1.html#%EC%BB%A8%ED%8A%B8%EB%A1%A4) 절을 참고하세요. ### UI 이벤트 지도의 탭 이벤트를 받으려면 `-onMapView:handleSingleTapGesture:` 대신 [-didTapMapView:LatLng:](https://navermaps.github.io/ios-map-sdk/reference/Protocols/NMFMapViewDelegate.html#/c%3Aobjc%28pl%29NMFMapViewDelegate%28im%29didTapMapView:LatLng:) 메서드를 이용해 콜백 이벤트를 받습니다. 다음은 지도의 탭 이벤트를 받아 탭된 좌표를 출력하는 예제입니다. #### 2.x ``` - (void) onMapView:(NMapView *)mapView handleSingleTapGesture:(UIGestureRecognizer*)recogniser { NGeoPoint coord = [mapView fromPoint:[recogniser locationInView:mapView]]; NSLog(@"탭 : %f, %f", coord.latitude, coord.longitude); } ``` #### 3.x ``` - (void)didTapMapView:(CGPoint)point LatLng:(NMGLatLng *)latlng { NSLog(@"탭 : %f, %f", latlng.lat, latlng.lng); } ``` 자세한 내용은 [사용자 인터페이스](https://navermaps.github.io/ios-map-sdk/guide-ko/4-1.html) 문서의 [UI 이벤트](https://navermaps.github.io/ios-map-sdk/guide-ko/4-1.html#ui-%EC%9D%B4%EB%B2%A4%ED%8A%B8) 절을 참고하세요. ### 위치 2.x SDK는 위치 추적 기능을 사용하려면 `NMapLocationManager`, `NMapMyLocationOverlay`를 생성하고 기능을 활성화하는 메서드를 각각 호출해야 했습니다. 3.x SDK에는 위치 추적 기능이 내장되어 있으므로 [NMFNaverMapView.positionMode](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFNaverMapView.html#/c%3Aobjc%28cs%29NMFNaverMapView%28py%29positionMode) 속성을 변경하면 위치 추적 기능이 활성화됩니다. 다음은 위치 추적 기능을 활성화하는 예제입니다. #### 2.x ``` - (void)findMyLocation { NMapLocationManager *lm = [NMapLocationManager getSharedInstance]; [lm setDelegate:self]; [self.mapView setAutoRotateEnabled:YES]; [lm startUpdatingHeading]; [lm startContinuousLocationInfo]; } - (void)locationManager:(NMapLocationManager *)locationManager didUpdateToLocation:(CLLocation *)location { CLLocationCoordinate2D coordinate = [location coordinate]; NGeoPoint myLocation; myLocation.longitude = coordinate.longitude; myLocation.latitude = coordinate.latitude; float locationAccuracy = [location horizontalAccuracy]; [[self.mapView mapOverlayManager] setMyLocation:myLocation locationAccuracy:locationAccuracy]; [self.mapView setMapCenter:myLocation]; } - (void)locationManager:(NMapLocationManager *)locationManager didUpdateHeading:(CLHeading *)heading { double headingValue = [heading trueHeading] < 0.0 ? [heading magneticHeading] : [heading trueHeading]; [self.mapView setRotateAngle:(CGFloat)headingValue]; } ``` #### 3.x ``` self.naverMapView.positionMode = NMFMyPositionCompass; ``` 자세한 내용은 [위치](https://navermaps.github.io/ios-map-sdk/guide-ko/4-2.html) 문서를 참고하세요. ## 오버레이 ### 사용 준비 2.x SDK에서 오버레이 기능을 사용하려면 먼저 `NMapPOIdataOverlayDelegate` 관련 메서드를 구현하고, 각 오버레이에 `NMapXXXdata`를 생성한 후 `NMapOverlayManager.newXXXOverlay:` 메서드를 호출해야 했습니다. 3.x SDK에서는 오버레이 객체 각각이 기능을 독립적으로 완결성 있게 수행하므로 이러한 준비 과정이 필요하지 않습니다. 필요한 오버레이 객체를 생성하고 속성을 객체에 직접 지정한 후 `mapView` 속성에 표시할 지도를 지정하면 오버레이가 나타납니다. 다음은 오버레이 기능을 사용하기 위해 관련 객체를 준비하는 예제입니다. #### 2.x ``` NMapOverlayManager *mapOverlayManager = [self.mapView mapOverlayManager]; ``` #### 3.x ``` // 준비 과정 불필요 ``` ### 탭 이벤트 2.x SDK에서는 오버레이의 탭 이벤트를 받으려면 `NMapPOIdataOverlayDelegate`에서 정의된 메서드를 구현하고, `-onMapOverlay:didChangeSelectedPOIitemAtIndex:withObject:` 등의 메서드에서 이벤트를 구현해야 했습니다. 3.x SDK에서는 [NMFOverlay.touchHandler](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFOverlay.html#/c%3Aobjc%28cs%29NMFOverlay%28py%29touchHandler) 속성에 블록 메서드로 [NMFOverlayTouchHandler](https://navermaps.github.io/ios-map-sdk/reference/Overlay.html#/c%3ANMFOverlay.h@T@NMFOverlayTouchHandler)를 지정합니다. #### 2.x ``` NMapPOIdataOverlay overlay = ... - (BOOL) onMapOverlay:(NMapPOIdataOverlay *)poiDataOverlay didChangeSelectedPOIitemAtIndex:(int)index withObject:(id)object { NSLog(@"오버레이 탭: %d", index); return YES; } - (BOOL) onMapOverlay:(NMapPOIdataOverlay *)poiDataOverlay didSelectCalloutOfPOIitemAtIndex:(int)index withObject:(id)object { NSLog(@"정보 창 탭: %d", index); return YES; } ``` #### 3.x ``` NMFOverlay *overlay = ... overlay.touchHandler = ^BOOL(NMFOverlay *overlay) { NSLog(@"오버레이 탭"); return YES; }; ``` 자세한 내용은 [오버레이 공통](https://navermaps.github.io/ios-map-sdk/guide-ko/5-1.html) 문서의 [이벤트](https://navermaps.github.io/ios-map-sdk/guide-ko/5-1.html#%EC%9D%B4%EB%B2%A4%ED%8A%B8) 절을 참고하세요. ### 마커 2.x SDK에서는 마커를 지도에 추가하려면 `NMapPOIdata`를 생성하고 `NMapOverlayManager.newPOIdataOverlay`를 호출해야 했습니다. 3.x SDK에서는 [NMFMarker](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFMarker.html) 객체를 생성하고 필요한 속성을 객체에 직접 지정한 후 `mapView` 속성에 표시할 지도를 지정합니다. 마커 드래그 기능은 더 이상 제공되지 않습니다. 다음은 마커를 지도에 추가하는 예제입니다. #### 2.x ``` NMapOverlayManager *mapOverlayManager = [_mapView mapOverlayManager]; NMapPOIdataOverlay *poiDataOverlay = [mapOverlayManager newPOIdataOverlay]; [poiDataOverlay initPOIdata:1]; [poiDataOverlay addPOIitemAtLocation:NGeoPointMake(126.9783740, 37.5670135) title:nil type:NMapPOIflagTypePin iconIndex:0 withObject:nil]; [poiDataOverlay endPOIdata]; [poiDataOverlay showAllPOIdata]; ``` #### 3.x ``` NMFMarker *marker = [NMFMarker markerWithPosition:NMGLatLngMake(37.5670135, 126.9783740)]; marker.mapView = self.mapView; ``` 자세한 내용은 [마커](https://navermaps.github.io/ios-map-sdk/guide-ko/5-2.html) 문서를 참고하세요. ### 정보 창 2.x SDK에서는 마커의 제목을 지정한 경우 마커를 탭하면 자동으로 마커의 위에 정보 창이 나타났습니다. 정보 창을 별도로 생성하거나 동시에 한 개 이상 노출할 수 없었습니다. 3.x SDK에서는 정보 창도 마커처럼 독립적인 객체이므로 자유롭게 생성하고 추가할 수 있습니다. 정보 창을 지도에 추가하려면 [NMFInfoWindow](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFInfoWindow.html) 객체를 생성하고 필요한 속성을 객체에 직접 지정한 후 `-openWithMapView:`를 호출합니다. 다음은 마커를 탭하면 정보 창을 지도에 추가하는 예제입니다. #### 2.x ``` NMapOverlayManager *mapOverlayManager = [self.mapView mapOverlayManager]; NMapPOIdataOverlay *poiDataOverlay = [mapOverlayManager newPOIdataOverlay]; [poiDataOverlay initPOIdata:1]; [poiDataOverlay addPOIitemAtLocation:NGeoPointMake(126.9783740, 37.5670135) title:@"정보 창 내용" type:NMapPOIflagTypePin iconIndex:0 withObject:nil]; [poiDataOverlay endPOIdata]; [poiDataOverlay showAllPOIdata]; - (UIView*) onMapOverlay:(NMapPOIdataOverlay *)poiDataOverlay viewForCalloutOverlayItem:(NMapPOIitem *)poiItem calloutPosition:(CGPoint *)calloutPosition { self.callOutLabel.text = poiItem.title; return self.callOutView; } - (BOOL) onMapOverlay:(NMapPOIdataOverlay *)poiDataOverlay didSelectCalloutOfPOIitemAtIndex:(int)index withObject:(id)object { NSLog(@"정보 창 탭: %d", index); return YES; } ``` #### 3.x ``` NMFInfoWindow *infoWindow = [NMFInfoWindow infoWindow]; infoWindow.dataSource = [NaverDefaultInfoWindowImage defaultInfoWindowImage]; infoWindow.touchHandler = ^BOOL(NMFOverlay *overlay) { NSLog(@"정보 창 탭"); return YES; }; NMFMarker *marker = [NMFMarker markerWithPosition:NMGLatLngMake(37.5670135, 126.9783740)]; marker.userInfo = @{INFOWINDOW_TITLE_KEY:@"정보 창 내용"}; marker.touchHandler = ^BOOL(NMFOverlay *overlay) { [infoWindow openWithMarker:(NMFMarker *)overlay]; return YES; }; marker.mapView = self.mapView; ``` 자세한 내용은 [정보 창](https://navermaps.github.io/ios-map-sdk/guide-ko/5-3.html) 문서를 참고하세요. ### 셰이프 2.x SDK에서는 셰이프를 지도에 추가하려면 `NMapPathData`에 셰이프의 좌표를, `NMapPathLineStyle` 또는 `NMapCircleStyle` 객체를 이용해 셰이프의 스타일을 지정하고 `NMapOverlayManager.newPathDataOverlay:`를 호출해야 했습니다. 3.x SDK에서는 [NMFPolylineOverlay](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFPolylineOverlay.html), [NMFPolygonOverlay](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFPolygonOverlay.html), [NMFCircleOverlay](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFCircleOverlay.html) 등 유형별 셰이프 객체를 생성하고 필요한 속성을 객체에 직접 지정한 후 `mapView` 속성에 표시할 지도를 지정합니다. 다음은 폴리라인을 지도에 추가하는 예제입니다. #### 2.x ``` NMapPathData *pathData = [[NMapPathData alloc] initWithCapacity:4]; [pathData initPathData]; [pathData addPathPointLongitude:126.97714 latitude:37.57152 lineType:NMapPathLineTypeSolid]; [pathData addPathPointLongitude:126.98268 latitude:37.56607 lineType:0]; [pathData addPathPointLongitude:126.97707 latitude:37.56445 lineType:0]; [pathData addPathPointLongitude:126.97822 latitude:37.55855 lineType:0]; [pathData endPathData]; NMapPathLineStyle *style = [[NMapPathLineStyle alloc] init]; [style setPathDataType:NMapPathDataTypePolyline]; [style setLineColor:[UIColor greenColor]]; [pathData setPathLineStyle:style]; NMapPathDataOverlay *pathDataOverlay = [mapOverlayManager newPathDataOverlay:pathData]; [pathDataOverlay showAllPathData]; ``` #### 3.x ``` NMFPolylineOverlay *polyline = [NMFPolylineOverlay polylineOverlayWithPoints: @[ NMGLatLngMake(37.57152, 126.97714), NMGLatLngMake(37.56607, 126.98268), NMGLatLngMake(37.56445, 126.97707), NMGLatLngMake(37.55855, 126.97822) ]]; polyline.color = UIColor.greenColor; polyline.mapView = self.mapView; ``` 다음은 폴리곤을 지도에 추가하는 예제입니다. #### 2.x ``` NMapOverlayManager *mapOverlayManager = [self.mapView mapOverlayManager]; NMapPathData *pathData = [[NMapPathData alloc] initWithCapacity:5]; [pathData initPathData]; [pathData addPathPointLongitude:126.9712268 latitude:37.5640984 lineType:NMapPathLineTypeSolid]; [pathData addPathPointLongitude:126.9767904 latitude:37.5651279 lineType:0]; [pathData addPathPointLongitude:126.9832241 latitude:37.5625365 lineType:0]; [pathData addPathPointLongitude:126.9809297 latitude:37.5585305 lineType:0]; [pathData addPathPointLongitude:126.974617 latitude:37.5590777 lineType:0]; [pathData endPathData]; NMapPathLineStyle *style = [[NMapPathLineStyle alloc] init]; [style setPathDataType:NMapPathDataTypePolygon]; [style setLineColor:[UIColor greenColor]]; [style setFillColor:[UIColor whiteColor]]; [pathData setPathLineStyle:style]; NMapPathDataOverlay *pathDataOverlay = [mapOverlayManager newPathDataOverlay:pathData]; [pathDataOverlay showAllPathData]; ``` #### 3.x ``` NMGPolygon *polygon = [NMGPolygon polygonWithRing: [NMGLineString lineStringWithPoints:@[ NMGLatLngMake(37.5640984, 126.9712268), NMGLatLngMake(37.5651279, 126.9767904), NMGLatLngMake(37.5625365, 126.9832241), NMGLatLngMake(37.5585305, 126.9809297), NMGLatLngMake(37.5590777, 126.974617) ]]]; NMFPolygonOverlay *polygonOverlay = [NMFPolygonOverlay polygonOverlay:polygon]; polygonOverlay.fillColor = UIColor.whiteColor; polygonOverlay.outlineColor = UIColor.greenColor; polygonOverlay.mapView = self.mapView; ``` 다음은 서클을 지도에 추가하는 예제입니다. #### 2.x ``` NMapOverlayManager *mapOverlayManager = [self.mapView mapOverlayManager]; NMapPathDataOverlay *pathDataOverlay = [mapOverlayManager newPathDataOverlay:[[NMapPathData alloc] init]]; NMapCircleData *circleData = [[NMapCircleData alloc] initWithCapacity:1]; [circleData initCircleData]; [circleData addCirclePointLongitude:126.9783881 latitude:37.5666102 radius:50.0F]; NMapCircleStyle *circleStyle = [[NMapCircleStyle alloc] init]; [circleStyle setFillColor:[UIColor whiteColor]]; [circleStyle setStrokeColor:[UIColor greenColor]]; [circleData setCircleStyle:circleStyle]; [circleData endCircleData]; [pathDataOverlay addCircleData:circleData]; [pathDataOverlay showAllPathData]; ``` #### 3.x ``` NMFCircleOverlay* circleOverlay = [NMFCircleOverlay circleOverlay:NMGLatLngMake(37.5666102, 126.9783881) radius:50]; circleOverlay.fillColor = UIColor.whiteColor; circleOverlay.outlineColor = UIColor.greenColor; circleOverlay.mapView = self.mapView; ``` 자세한 내용은 [셰이프](https://navermaps.github.io/ios-map-sdk/guide-ko/5-4.html) 문서를 참고하세요. ### 위치 오버레이 2.x SDK는 위치 오버레이가 분리되지 않아 `NMapOverlayManager`를 통해서만 위치 오버레이에 접근할 수 있었습니다. 3.x SDK는 위치 오버레이가 독립적으로 동작하므로 [NMFMapView.locationOverlay](https://navermaps.github.io/ios-map-sdk/reference/Classes/NMFMapView.html#/c%3Aobjc%28cs%29NMFMapView%28py%29locationOverlay) 속성을 호출해 인스턴스에 접근한 후 필요한 속성을 직접 지정할 수 있습니다. #### 2.x ``` [[self.mapView mapOverlayManager] setMyLocation:myLocation locationAccuracy:locationAccuracy]; ``` #### 3.x ``` NMFLocationOverlay *locationOverlay = self.mapView.locationOverlay; locationOverlay.hidden = NO; ``` 자세한 내용은 [위치 오버레이](https://navermaps.github.io/ios-map-sdk/guide-ko/5-5.html) 문서를 참고하세요.