Titanium 如何添加';当前位置按钮';(导航标记)在Ti地图上的苹果地图上

Titanium 如何添加';当前位置按钮';(导航标记)在Ti地图上的苹果地图上,titanium,apple-maps,Titanium,Apple Maps,我正在为我的Tianium iOS/android使用Ti.map 至于安卓 此时会自动添加“当前位置”按钮 (我不知道这个按钮叫什么,所以我现在称它为“当前位置按钮” 但是对于iOS来说, “当前位置”按钮不会自动添加 有没有办法在苹果地图上添加这个按钮 这是我的密码 var mapView = Map.createView({ mapType:Map.NORMAL_TYPE, userLocation:true, region: {l

我正在为我的Tianium iOS/android使用Ti.map

至于安卓

此时会自动添加“当前位置”按钮

(我不知道这个按钮叫什么,所以我现在称它为“当前位置按钮”

但是对于iOS来说,

“当前位置”按钮不会自动添加

有没有办法在苹果地图上添加这个按钮

这是我的密码

    var mapView = Map.createView({
        mapType:Map.NORMAL_TYPE,
        userLocation:true,
        region: {latitude:35.699058, longitude:139.326099,    
        latitudeDelta:0.01, longitudeDelta:0.01},
        animate:false,
        regionFit:true,
        userLocation:true,
    });

我读了这篇文章后发现

  -   To use the `userLocation` property in iOS 8 and later, add either the
        [`NSLocationWhenInUseUsageDescription`](https://developer.apple.com/library/prerelease/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW26)
        or
        [`NSLocationAlwaysUsageDescription`](https://developer.apple.com/library/prerelease/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW18)
        key to the iOS plist section of the project's `tiapp.xml` file.
            <ti:app>
                <ios>
                    <plist>
                        <dict>
                            <key>NSLocationAlwaysUsageDescription</key>
                            <string>
                                Specify the reason for accessing the user's location information.
                                This appears in the alert dialog when asking the user for permission to
                                access their location.
                            </string>
                        </dict>
                    </plist>
                </ios>
            </ti:app>


现在它运行良好,感谢您的帮助。

创建地图时,您需要设置一个额外的属性:

require('ti.map').createView({mapType:MapModule.SATELLITE_TYPE, userLocation:true});
这应该可以奏效;-)


/约翰

谢谢你的回复!,我有一些问题。这将是卫星类型的视图。无法将currentlocation按钮添加到normal map?中?。即使我添加了此代码,用户位置按钮也不会出现,MapModule.SATELLITE类型是Map.SATELLITE类型的拼写错误??谢谢给我提示,我知道如何集成我想要的内容。@whitebear:是的,你可以使用任何你想要的地图类型。这只是我在代码中复制的示例。对不起,我没有指出:-)你要找的是另一个按钮。安卓系统上的谷歌地图是谷歌地图的原生版本。所以约翰的回答其实是正确的。啊,我看到这个按钮是安卓特有的,对吧?所以我必须自己制作另一个按钮,跳转到当前用户位置?
require('ti.map').createView({mapType:MapModule.SATELLITE_TYPE, userLocation:true});