https://kokojong.tistory.com/m/7
MapKit Annotations 전부 지우는 방법
self.mapView.removeAnnotations(self.mapView.annotations)
MapKit과제하다가 깨달은 점:
region 과 annotation은 항상 함께 따라다닌다 (따로쓰니깐 안됨)
func setRegionAndAnnotation(center: CLLocationCoordinate2D, brand: String, location: String) {
//지도 중심 기반으로 보여질 범위
let region = MKCoordinateRegion(center: center, latitudinalMeters: 20000, longitudinalMeters: 20000)
mapView.setRegion(region, animated: true)
//annotation 핀 고정
let annotation = MKPointAnnotation()
annotation.coordinate = center
annotation.title = location
mapView.addAnnotation(annotation)
}
'iOS > iOS SeSAC 2기 TIL' 카테고리의 다른 글
iOS swift Http 접근 허용하기 (0) | 2022.08.15 |
---|---|
iOS swift 현재 위치 가져오기 (0) | 2022.08.14 |
CoreLocation (0) | 2022.08.13 |
iOS swift 카메라 관련 (0) | 2022.08.12 |
TIL 08.10 (0) | 2022.08.10 |