Appcelerator Ti.map选定的注释图像

时间:2018-08-19 17:29:45

标签: android ios maps titanium appcelerator

我正在使用Appcelerator上的ti.map模块,似乎无法找到任何解决方案来更改选定的注释图像。该怎么办?

需要支持iOS和Android 使用Titanium SDK 7.2

2 个答案:

答案 0 :(得分:1)

尝试将自定义视图用作注释:

var myAnnotationView = Ti.UI.createView({
    backgroundImage: '/my_image.png',
});

var customAnnotation = map.createAnnotation({
   customView: myAnnotationView,
   latitude: lat,
   longitude: lon,
   title: 'My custom pin'
});

myAnnotationView.backgroundImage = '/my_image2.png';

答案 1 :(得分:0)

使用自定义视图:

var _costumView = Ti.UI.createView({
    backgroundImage: '/image1.png' }); 

var _annotation = map.createAnnotation({
   customView: _costumView,
   latitude: _latitude,
   longitude: _longitude
});

_costumView.backgroundImage = '/image2.png';
_annotation.customView = _costumView;
相关问题