1
사용자 위치에서 고유 한 원하는 위치에 투명 원 또는 사각형을 표시하는 방법을 파악하는 데 문제가 있습니다. Im mapkit 초보자 그래서 미리 감사드립니다.mapkit 및 swift를 사용하여 설정된 위치에 원을 오버레이하는 방법
class FirstViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate
{
@IBOutlet weak var mapView: MKMapView!
let locationManager = CLLocationManager()
override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.locationManager.delegate = self
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.locationManager.requestAlwaysAuthorization()
self.locationManager.startUpdatingLocation()
self.mapView.showsUserLocation = true
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
let location = locations.last
let center = CLLocationCoordinate2D(latitude: location!.coordinate.latitude, longitude: location!.coordinate.longitude)
let region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 1, longitudeDelta: 1))
self.mapView.setRegion(region, animated: true)
self.locationManager.stopUpdatingLocation()//
}
func locationManager(manager: CLLocationManager, didFailWithError error: NSError)
{
print("Errors: " + error.localizedDescription)
}
}
또 다른 옵션은 해당 원의 이미지로 맞춤 주석을 만드는 것입니다. 나는 당신이 그 유형의 기능을 원했던 조건 아래서 이것을 던지고 있습니다. – Sethmr