뷰 추가 성공시에 다음과같이 settingMap으로 카메라 핸들러를 추가했습니다.
카메라가 멈췄을때 현재 카메라의 위치를 출력하도록 하고싶은데 출력이 안됩니다.
혹시 잘못된 부분이 있는지, 아니면 다른 함수를 써야하는지 궁금합니다!
func settingMap() {
if let mapView = controller?.getView("mapview") as? KakaoMap {
cameraStoppedHandler = mapView
.addCameraStoppedEventHandler(target: self, handler: KakaoMapCoordinator.onCameraStopped)
}
func onCameraStopped(_ param: CameraActionEventParam) {
if let mapView = controller?.getView("mapview") as? KakaoMap {
let m = mapView.getPosition(CGPoint(x: mapView.viewRect.width * 0.5, y: mapView.viewRect.height * 0.5))
print(m.wgsCoord.latitude)
print(m.wgsCoord.longitude)
}
}