-4
Jemand haben Erfahrung mit Tracking-Weg, was ich mit CoreLocation gehe. Wie folgt aus:Way Map Tracker für MapKit oder Google Maps
Wenn jemand Probe haben mir bitte Link senden. Danke
Jemand haben Erfahrung mit Tracking-Weg, was ich mit CoreLocation gehe. Wie folgt aus:Way Map Tracker für MapKit oder Google Maps
Wenn jemand Probe haben mir bitte Link senden. Danke
Mit MKCircle
können Sie einfach Map-Tracker machen.
import UIKit
import MapKit
class ViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {
@IBOutlet weak var mapView: MKMapView!
var locationManager: CLLocationManager!
override func viewDidLoad() {
super.viewDidLoad()
mapView.showsUserLocation = true
if CLLocationManager.locationServicesEnabled() {
locationManager = CLLocationManager()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
}
}
// MARK: - MKMapView delegate
func mapView(_ mapView: MKMapView, didUpdate userLocation: MKUserLocation) {
let span = MKCoordinateSpanMake(0.01, 0.01)
let region = MKCoordinateRegionMake(userLocation.coordinate, span)
mapView.setRegion(region, animated:true)
let center = userLocation.coordinate
let circle = MKCircle(center: center, radius: 10)
mapView.add(circle)
}
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
let circleRenderer : MKCircleRenderer = MKCircleRenderer(overlay: overlay);
circleRenderer.fillColor = .blue
circleRenderer.lineWidth = 1.0
return circleRenderer
}
}