You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created some custom UIView and make it as ViewAnnotation , then add them to NavigationMapView
class SampleClass {
let navigationMapView: NavigationMapView!
let navigationViewController: NavigationViewController!
...
func renderWaypoints (points: [CLLocationCoordinate2D] , forSimulating : Bool = false) {
let alphabet = Array("SABCDEFGHIJKLMNOPQRSTUVWXYZ").map {String($0)}
for (index ,point) in points.enumerated() {
let size = 25.0
let roundView = UIView()
roundView.frame = CGRect(x: 0, y: 0, width: size, height: size)
roundView.backgroundColor = index == 0 ? #colorLiteral(red: 0.5843137503, green: 0.8235294223, blue: 0.4196078479, alpha: 1) : #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
roundView.layer.cornerRadius = size / 2// Half of the width/height to make it round
roundView.layer.borderColor = index == 0 ? #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1) : #colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 1)
roundView.layer.borderWidth = 1.5
let label = UILabel()
label.frame = CGRect(x: 0, y: 0, width: size, height: size)
label.text = alphabet[index]
label.textAlignment = .center
label.textColor = index == 0 ? .white : .darkGray
label.font = UIFont.systemFont(ofSize: 13, weight: UIFont.Weight.bold)
roundView.addSubview(label)
do {
if !forSimulating {
try navigationMapView.mapView.viewAnnotations.add(roundView, id:"Annotation_\(index)", options: ViewAnnotationOptions(geometry: Point(point), width: size, height: size))
}
else {
try navigationViewController.navigationMapView?.mapView.viewAnnotations.add(roundView, id:"Annotation_\(index)", options: ViewAnnotationOptions(geometry: Point(point), width: size, height: size))
}
}
catch {
print("Cannot add annotation")
}
}
}
While testing on simulator (iPhone 15 Pro, XCode 15.3), I see no problem. But when I switch to an iPhone 7 real device to testing, annotations start to drift a bit while moving the map fast. You can see at video below
rpreplay-final1716542967_vfGPbTxV.mov
Before implementing this custom waypoint, I already clone the example project https://github.com/mapbox/mapbox-navigation-ios-examples and read the example code about custom waypoints. However for some reasons, my code do not use showcase method of NavigationMapView, therefore I cannot implement appropriate function like the example.
Expected behavior
ViewAnnotation must be stick on the coordinates given , even when user moves a map
Actual behavior
ViewAnnotation drift its position when user moves a map
Is this a one-time issue or a repeatable issue?
one-time
The text was updated successfully, but these errors were encountered:
Mapbox Navigation SDK version
2.18
Steps to reproduce
I created some custom
UIView
and make it asViewAnnotation
, then add them toNavigationMapView
While testing on simulator (iPhone 15 Pro, XCode 15.3), I see no problem. But when I switch to an iPhone 7 real device to testing, annotations start to drift a bit while moving the map fast. You can see at video below
rpreplay-final1716542967_vfGPbTxV.mov
Before implementing this custom waypoint, I already clone the example project https://github.com/mapbox/mapbox-navigation-ios-examples and read the example code about custom waypoints. However for some reasons, my code do not use
showcase
method ofNavigationMapView
, therefore I cannot implement appropriate function like the example.Expected behavior
ViewAnnotation
must be stick on the coordinates given , even when user moves a mapActual behavior
ViewAnnotation
drift its position when user moves a mapIs this a one-time issue or a repeatable issue?
one-time
The text was updated successfully, but these errors were encountered: