Reputation: 1
I need to code for label on the map as product price in Titanium SDK. Anybody have any idea how to achieve this ?
Waiting for your kind response.
Upvotes: 0
Views: 236
Reputation: 1619
What i get from your question is that when you click on a map marker ( product in your case ) , you what to show price of that item as an info window ( for that marker ).
If this is the case then set title of your annotation as the product price.
Something like ( example taken from titanium docs) :
var Map = require('ti.map'); //extend map global object
var win = Titanium.UI.createWindow();
var mountainView = Map.createAnnotation({
latitude:37.390749,
longitude:-122.081651,
title:"Appcelerator Headquarters", //<--------- YOUR PRODUCT PRICE HERE
subtitle:'Mountain View, CA',
pincolor:Map.ANNOTATION_RED,
myid:1 // Custom property to uniquely identify this annotation.
});
var mapview = Map.createView({
mapType: Map.NORMAL_TYPE,
region: {latitude:33.74511, longitude:-84.38993,
latitudeDelta:0.01, longitudeDelta:0.01},
animate:true,
regionFit:true,
userLocation:true,
annotations:[mountainView]
});
win.add(mapview);
// Handle click events on any annotations on this map.
mapview.addEventListener('click', function(evt) {
Ti.API.info("Annotation " + evt.title + " clicked, id: " + evt.annotation.myid);
});
win.open();
Upvotes: 0