custom images for Annotation pin?

You must Login before you can answer or comment on any questions.

Hi,

is it possible to use a custom image as marker on the Titanium.Map.view? (or is there a nice ducktape-code-snippet?) If not: Would love to see this within the next version! :)

thank you, flo

4 Answers

For iPhone, you can use the 'image' property to replace the pin, but it needs to be a local image.

Hi, I dun think you can customize it. If you find a way, do let us know :-)

There seems to be an example in the KitchenSink?

var atlantaParams = {
        latitude:33.74511,
        longitude:-84.38993,
        title:"Atlanta, GA",
        subtitle:'Atlanta Braves Stadium',
        animate:true,
        leftButton:'../images/atlanta.jpg',
        rightButton: Titanium.UI.iPhone.SystemButton.DISCLOSURE,
        myid:3 // CUSTOM ATTRIBUTE THAT IS PASSED INTO EVENT OBJECTS
    };
 
if (!isAndroid) {
    atlantaParams.pincolor = Titanium.Map.ANNOTATION_PURPLE;
} else {
    atlantaParams.pinImage = "../images/map-pin.png";
}
var atlanta = Titanium.Map.createAnnotation(atlantaParams);

— answered 3 years ago by Mattias Svedhem
answer permalink
1 Comment
  • that only works in android. for the iphone, you can only have the normal 'pins' with the colors on a map, as the marker.

    rocksteady, danno~

    — commented 3 years ago by danno watts

This is now possible in both Android and iOS.

Using the Annotation.image property, you can specify an image path to view instead of the pin.

var atlantaParams = {
        latitude:33.74511,
        longitude:-84.38993,
        title:"Atlanta, GA",
        subtitle:'Atlanta Braves Stadium',
        animate:true,
        image: 'images/cityIcon.png',
        leftButton:'../images/atlanta.jpg',
        rightButton: Titanium.UI.iPhone.SystemButton.DISCLOSURE,
        myid:3 
    };
 
var atlanta = Titanium.Map.createAnnotation(atlantaParams);

Your Answer

Think you can help? Login to answer this question!