Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10203] iOS: Map Annotation image cannot be changed dynamically

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-08-14T09:09:42.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-15 API, Release 2.1.2, Release 3.0.0
ComponentsiOS
Labelsapi, module_map, parity, qe-testadded
ReporterPedro Enrique
AssigneeNeeraj Gupta
Created2012-07-26T18:59:59.000+0000
Updated2012-08-14T09:09:55.000+0000

Description

The problem

The map annotations can be represented by an image with the "image" property. That image cannot be dynamically changed.

The test case:

var changeButton = Ti.UI.createButton({
	title: 'change colour'
});
var win = Ti.UI.createWindow({
	rightNavButton: changeButton
});

var map = Ti.Map.createView({
	userLocation:false,
	animate: true,
	region: {
		latitude:12,
		longitude:12,
		latitudeDelta:1,
		longitudeDelta:1
	}
});

var annot = Ti.Map.createAnnotation({
	latitude:12,
	longitude:12,
	image: 'blue.png'
});

map.addAnnotation(annot);

win.add(map);
win.open({modal: true});

var isBlue = true;

changeButton.addEventListener('click', function(e){
	annot.image = isBlue ? 'yellow.png' : 'blue.png';
	isBlue = !isBlue;
});

To reproduce:

1. Copy and paste this code to app.js 2. Run the app and you'll see a blue pin 3. Click the right navigation button 4. The blue pin is still blue - it did not change to yellow. (Attached are the two images)

Attachments

FileDateSize
blue.png2012-07-26T18:59:59.000+00002457
yellow.png2012-07-26T18:59:59.000+00002241

Comments

  1. Pedro Enrique 2012-07-26

    Pull request ready: [2648](https://github.com/appcelerator/titanium_mobile/pull/2648)
  2. Ivan Markovic 2012-07-27

    Really hoping that this is a quick fix. I have 6 Apps that are waiting behind this issue. They are for Estate Agents here in the UK and as they sell houses, it's all about Maps and locations and showing pin selection is important. Thanks.
  3. Shyam Bhadauria 2012-08-10

    Re-opening to edit label
  4. Vishal Duggal 2012-08-14

    Reopening to add fixVersion
  5. Vishal Duggal 2012-08-14

    Closing after adding fixVersion

JSON Source