Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Here maps iOS SDK:在Here maps中旋转标记_Ios_Swift_Here Api_Here Maps Rest_Here Ios - Fatal编程技术网

Here maps iOS SDK:在Here maps中旋转标记

Here maps iOS SDK:在Here maps中旋转标记,ios,swift,here-api,here-maps-rest,here-ios,Ios,Swift,Here Api,Here Maps Rest,Here Ios,我正在使用heremaps开发一个车辆跟踪应用程序。我想根据车辆转弯的角度将此处地图中的标记图标(NMAMapMarker)旋转到特定角度(类似于Uber应用程序)。我之前使用过Google maps,Google maps中的marker提供了一个旋转属性来将标记旋转到特定角度。这里有类似的房产吗 这个有更新吗 谢谢一般来说,不可能旋转NMAMapMarker,在此iOS Premium SDK中,默认位置指示器NMAPositionIndicator具有属性TrackRoss,该属性将使用

我正在使用heremaps开发一个车辆跟踪应用程序。我想根据车辆转弯的角度将此处地图中的标记图标(NMAMapMarker)旋转到特定角度(类似于Uber应用程序)。我之前使用过Google maps,Google maps中的marker提供了一个旋转属性来将标记旋转到特定角度。这里有类似的房产吗

这个有更新吗


谢谢

一般来说,不可能旋转NMAMapMarker,在此iOS Premium SDK中,默认位置指示器NMAPositionIndicator具有属性TrackRoss,该属性将使用设备提供的标题旋转指示器

另一种选择是使用NMAMapLocalModel,正如上面的评论中提到的那样

   ... 
   NMAFloatMesh *mesh = [[NMAFloatMesh alloc] init];

    float size = 5.0f;

    float vertices[4 * 3] = {-size / 2,   -size/2, 0.0f,
        -size/2,   size / 2, 0.0f,
        size / 2,   -size/2, 0.0f,
        size/2,   size/2, 0.0f,
    };

    [mesh setVertices:vertices withCount:4];

    float textureCoordinates[4 * 2] = {0.0,  0.0,
        0.0,  1.0,
        1.0,  0.0,
        1.0,  1.0};

    [mesh setTextureCoordinates:textureCoordinates withCount:4];

    short triangles[2 * 3] = {2, 1, 0,
        1, 2, 3};

    [mesh setTriangles:triangles withCount:2];

    _customPosIndicator = [[NMAMapLocalModel alloc] initWithMesh:mesh];

    NMAImage *image = [NMAImage imageWithUIImage:[UIImage imageNamed:@"256-256-pin2.png"]];

    /*
     // To load svg file as a custom position indicator, please use this code.
     NSBundle* main = [NSBundle mainBundle];
     NSString *resourcePath = [main pathForResource:@"tracker-1093167" ofType:@"svg"];

     NSLog(@"resourcePath: %@", resourcePath);
     NSData *resourceData = [NSData dataWithContentsOfFile:resourcePath];
     NMAImage *image = [NMAImage imageWithData:resourceData];
     */

    [_customPosIndicator setAutoscaled:true];
    [_customPosIndicator setTexture:image];
    [_customPosIndicator setCoordinates:[NMAGeoCoordinates alloc]];

    self.mapView.positionIndicator.displayObject = _customPosIndicator;

    self.mapView.positionIndicator.visible = true;

    ...

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(nonnull CLHeading *)newHeading {
    NSLog(@"%f", newHeading.magneticHeading);
    if(_customPosIndicator != nil){
        [_customPosIndicator setYaw:newHeading.magneticHeading];
    }
}

我不明白为什么这个问题会被否决。在对这个问题投反对票之前,请添加一条评论,告诉我为什么你认为这个问题有资格投反对票。这肯定会改善我未来的问题。向上投票,因为我认为这是一个相关的问题。你可能会投反对票,因为这个问题基本上与你链接的问题重复。@可以编写,我理解,但它是三年前在安卓系统中提出的。在此之后,“地图”为他们的SDK添加了新功能。我没有放弃投票,但你说你不明白为什么,所以我试着解释。SDK不提供您想要的功能,因此您可能需要查看一些较旧的解决方案,并提出自己的iOS解决方案