【发布时间】:2011-12-16 06:48:59
【问题描述】:
我正在地图视图上进行多个注释,并且正在打开一个新的详细信息窗口以选择右键。我应该通过标签在 detailWindow 中显示一些信息,并且每个引脚注释要显示的信息是不同的。如何将一些数据存储到引脚注释中?帮助我完成这项工作。提前致谢。
这是我的代码.. 注释创建:
okBtn.addEventListener("click", function(e) {
Ti.API.info("Text = " + textField.value);
mapview.removeAllAnnotations();
Ti.Geolocation.forwardGeocoder(textField.value, function(e) {
var annotations = [];
for(var i = 0; i < 10; i++) {
var pin = Titanium.Map.createAnnotation({
latitude : e.latitude-i,
longitude : e.longitude-i,
animate : true,
pincolor : Titanium.Map.ANNOTATION_RED,
rightButton : Titanium.UI.iPhone.SystemButton.DISCLOSURE//'rightButton.png'
});
annotations[i] = pin;
// suppose mapView is your map object
mapview.addAnnotation(annotations[i]);
}
var region = {
latitude : e.latitude,
longitude : e.longitude,
animate : true,
latitudeDelta : 0.15,
longitudeDelta : 0.15
};
mapview.setLocation(region);
Ti.API.info(e);
});
});
var detailWindow = Ti.UI.createWindow({
backgroundColor : "#fff",
navBarHidden : true,
backgroundImage : 'screen.png'
});
var detailTitle = Ti.UI.createLabel({
color : '#EC6512',
font : {
fontSize : 18,
fontWeight : 'bold',
fontFamily : 'Arial'
},
left : 12,
top : 60,
height : 80,
width : 300,
clickName : 'detailTitle',
});
detailWindow.add(detailTitle);
我应该将文本添加到 rightButtonEvent 中的detailTitle 标签。
rightButton 事件:
mapview.addEventListener('click', function(evt) {
if(evt.clicksource == 'rightButton') {
Titanium.API.info('Right button clicked');
navGroup.open(detailWindow);
};
});
我需要创建一个标签并发送数据以显示在标签中。
【问题讨论】:
-
请出示该代码,以便我向您推荐解决方案。注释创建和右键单击事件
标签: iphone annotations titanium android-mapview appcelerator