Project 22 - MapView

DaY·2021년 6월 2일
1

iOS

목록 보기
47/52
post-thumbnail

CLLocationManager

위치정보와 관련된 이벤트를 처리하는 역할을 하는 객체

CLLocationDistance

기존 위치에서의 거리 측정(미터 단위)

CLLocation

시스템에서보고 한 위도, 경도 및 코스 정보

MKCoordinateRegion

특정 위도와 경도를 중심으로하는 직사각형 지리적 영역

어플리케이션 승인 상태 확인

authorizationStatus를 이용하여 승인 상태를 확인해 사용자의 위치를 수집할 지 결정

private func checkLocationAuthorizationStatus() {
    if CLLocationManager.authorizationStatus() == .authorizedWhenInUse {
        mapView.showsUserLocation = true
    } else {
        locationManager.requestWhenInUseAuthorization()
    }
}

MKMapViewDelegate

지정된 주석 개체와 관련된보기를 반환

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
    var view: MKPinAnnotationView?
    
    return view
}

사용자가 주석보기의 액세서리 버튼 중 하나를 탭했음을 알림

func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {

}

0개의 댓글