Skip to content

Conversation

@m1ga
Copy link
Contributor

@m1ga m1ga commented Oct 21, 2023

⚠️ not sure if the code is the best. But the test app worked. Feel free to adjust or test it ⚠️

Adds a fireevent to the leftButton/leftView or rightButton/rightView again.

Test

var Map = require('ti.map');
var win = Titanium.UI.createWindow();

var mountainView = Map.createAnnotation({
	latitude: 37.390749,
	longitude: -122.081651,
	title: 'Appcelerator Headquarters',
	subtitle: 'Mountain View, CA',
	leftButton: Ti.UI.iOS.SystemButton.INFO_LIGHT,
	rightView: Ti.UI.createView({width: 50,height: 50, backgroundColor:"red"}),
});
var lbl = Ti.UI.createLabel({bottom: 20, text: "-", backgroundColor: "#fff"});

var mapview = Map.createView({
	mapType: Map.NORMAL_TYPE,
	region: {
		latitude: 37.390749,
		longitude: -122.081651,
		latitudeDelta: 0.01,
		longitudeDelta: 0.01
	},
	animate: true,
	regionFit: true,
	userLocation: true,
	annotations: [mountainView]
});

win.add(mapview);
win.add(lbl);

var clickCounter = 0;
mapview.addEventListener('click', function(event) {
	console.log(lbl.text = clickCounter + ': clicked ' + event.clicksource);
	lbl.text = clickCounter + ': clicked ' + event.clicksource + " - " + event.title;
	clickCounter++;
});
win.open();

click on the left button or right view inside the annotation and look at the log/label at the bottom.

ti.map-iphone-7.3.2.zip

Bildschirmaufnahme.2023-10-21.um.13.08.18.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants