: .
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
{
if ( == UIGestureRecognizerStateBegan) 坐标转换
{
CLLocationCoordinate2D coordinate = [_mapView convertPoint:[gesture
locationInView:_mapView] toCoordinateFromView:_mapView];
// 添加标注 更新目的地标记
if (_destinationPoint != nil)
{
// 清理
[_mapView removeAnnotation:_destinationPoint];
_destinationPoint = nil;
}
_destinationPoint = [[MAPointAnnotation alloc] init];
= coordinate;
= @"Destination";
[_mapView addAnnotation:_destinationPoint];
}
}
6选择目的地
7搜索路线
路线搜索类型
AMapSearchType_NaviDrive 驾⻋
AMapSearchType_NaviWalking 步⾏
AMapSearchType_NaviBus 公交
返回结果类型 AMapRoute
以步⾏结果举例
AMapRoute AMapPath AMapStep
⽅案 步骤
path0 step0
route path1 step1
path2 step2
… …
8搜索路线
添加搜索按钮
- (void)initControls
{
…
UIButton *pathButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
pathButt
地图-iOS-SDK-课程4 来自淘豆网m.daumloan.com转载请标明出处.