Problem description
Changing an annotation position (setLatitude/setLongitude) does not reflect in the map, unless the map is resized. However, the first time the position is changed, it works.
Steps to reproduce
Use the following code to test the behavior. The app changes the position of the annotation every 5 seconds, but only the first time it works. Try to resize the view, and see the annotation position is updated.
var win = Titanium.UI.createWindow({
});
var POI1 = [53.5439796, 9.9524117], CENTER = [53.5459431, 9.9598360], POI2 = [53.5450506, 9.9674320];
var map = Ti.Map.createView({
mapType : Titanium.Map.HYBRID_TYPE,
region : {
latitude : CENTER[0],
longitude : CENTER[1],
latitudeDelta : 0.03,
longitudeDelta : 0.03
}
});
var poi = Ti.Map.createAnnotation({
latitude : POI1[0],
longitude : POI1[1],
title : 'FISCHMARKT',
});
map.addAnnotation(poi);
map.selectAnnotation(poi);
win.add(map);
win.open();
setInterval(function() {
if (poi.title == 'FISCHMARKT') {
poi.setLatitude(POI2[0]);
poi.setLongitude(POI2[1]);
poi.title = 'LANDUNGSBRÜCKEN';
Ti.API.log('POI moved to Landungsbrücken');
} else {
poi.setLatitude(POI1[0]);
poi.setLongitude(POI1[1]);
poi.title = 'FISCHMARKT';
Ti.API.log('POI moved to Fischmarkt');
}
}, 5000);
Additional note
Adding these 2 lines to simulate the zoom in/out works, although it is an ugly workaround:
map.zoom(0.1);
map.zoom(-0.1);
Pull pending https://github.com/appcelerator/titanium_mobile/pull/2900
I tried updating my SDK but it seems it still doesn't work. How can I use this fix as soon as possible? Thank you, hope somebody can answer...
@Ryan: which version of the SDK did you try?
Reopened by mistake. resolving