【发布时间】:2015-11-14 09:54:48
【问题描述】:
我正在使用 Skobbler ios SDK。
我在地图视图中添加了两个注释。然后我在这两点之间进行路由。路由成功,但第一个点的注释(pin),起点消失了——实际上第一个注释移动到第二个注释后面。如果我仔细查看路线末尾的第二个注释(引脚),我可以看到它后面还有另一个注释。
当我点击注释时,应用会显示注释的标注。如果我仔细点击终点注释后面的注释,路线开头的第一个注释的标注会出现在其原始起点位置。路线开头的注释不正确(在我看来)移动到路线末尾的注释后面,但它的标注仍然在路线开头的正确位置。
为什么第一个注释会移动,我怎样才能让它保持在原来的位置。
谢谢!
编辑: iOS 9,斯威夫特。
其非常通用的代码取自http://developer.skobbler.com/getting-started/的 sn-ps
func mapView(mapView: SKMapView, didLongTapAtCoordinate coordinate: CLLocationCoordinate2D) {
let annotation = ABPAnnotation()
annotations.append(annotation)
annotation.identifier = Int32(annotations.count)
annotation.annotationType = SKAnnotationType.Red
annotation.location = coordinate
let animationSettings = SKAnimationSettings()
mapView.addAnnotation(annotation, withAnimationSettings: animationSettings)
self.mapView(mapView, didSelectAnnotation: annotation)
}
func mapView(mapView:SKMapView!, didSelectAnnotation annotation:SKAnnotation!) {
mapView.calloutView.location = annotation.location
mapView.calloutView.titleLabel.text = "Annotation"
mapView.calloutView.subtitleLabel.text = "subtitle"
mapView.showCalloutForAnnotation(annotation, withOffset: CGPointMake(0, 42),
animated: false);
}
@IBAction func routeAction(sender: AnyObject) {
let route = SKRouteSettings()
route.startCoordinate = annotations[0].location
route.destinationCoordinate = annotations[1].location
route.shouldBeRendered = true
route.routeMode = SKRouteMode.CarEfficient
route.maximumReturnedRoutes = 1
route.routeRestrictions.avoidHighways = false
route.requestAdvices = true
SKRoutingService.sharedInstance().calculateRoute(route)
}
func routingService(routingService: SKRoutingService!,
didFinishRouteCalculationWithInfo routeInformation: SKRouteInformation!) {
routingService.zoomToRouteWithInsets(UIEdgeInsetsZero, duration: 400)
}
【问题讨论】:
-
请添加您用于将注释添加到此问题的代码(包括您用于注释的 ID)。你会调用 updateAnnotation 吗?
-
这是安卓问题还是iOS问题?
-
已编辑:添加代码。使用 xcode 7.1,iOS 9
-
遇到了类似的问题,发到了skobbler论坛。我确实有一个解决方法,在论坛中提到。到目前为止,Skobbler 似乎没有真正的解决方案。 forum.skobbler.com/showthread.php/…
-
我在寻找解决方案时在 Skobbler 论坛上看到了您的帖子。我们正在评估使用 Skobbler 进行大型部署。它似乎非常符合我们的需要,但我有点失望在这里没有听到任何消息,或者在我在 Skobbler 论坛上的帖子。 (forum.skobbler.com/showthread.php/…)。