Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10739] iOS: change annotation position works only once, unless the map zoom changes

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-21T16:36:57.000+0000
Affected Version/sRelease 2.1.2
Fix Version/sRelease 3.0.0, Sprint 2012-19 API, 2012 Sprint 19
ComponentsiOS
Labelsapi
ReporterDavide Cassenti
AssigneeVishal Duggal
Created2012-09-03T07:16:19.000+0000
Updated2012-09-21T17:27:29.000+0000

Description

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);

Comments

  1. Vishal Duggal 2012-09-10

    Pull pending https://github.com/appcelerator/titanium_mobile/pull/2900
  2. Ryan 2012-09-19

    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...
  3. Davide Cassenti 2012-09-19

    @Ryan: which version of the SDK did you try?
  4. Vishal Duggal 2012-09-21

    Reopened by mistake. resolving

JSON Source