0
如果javascript被调用或执行,依赖于什么?我有两个功能,这都被调用以同样的方式,要精确:什么时候对javascript函数的objective-c调用被调用/执行,什么时候不调用?
[self.mapView stringByEvaluatingJavaScriptFromString:
[NSString stringWithFormat:@"setMarkerAtPosition(%f,%f)",
latlong.latitude, latlong.longitude]];
和
[self.mapView stringByEvaluatingJavaScriptFromString:@"test()"];
但calculateRoute()
被执行,而test()
不是。怎么来的?
function setMarkerAtPosition(lat, long){
var position = new google.maps.LatLng(lat, long);
var marker = new google.maps.Marker({position: position,
map: map,
title:"Hello World!",
animation: google.maps.Animation.DROP});
var content = "Ich bin eine normale Infobox";
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(content);
infowindow.open(map,marker);
reportClickedMarker();
});
}
function test(){
alert(currentPosition.latitude + ', ' + currentPosition.longitude);
}
谢谢
你可能需要证明被调用这些功能 – jmort253
它比函数名 – MJB
好吧,你是不一样的其他代码得到我。你需要包含调用这些函数的代码;否则,你的问题的答案是“你的猜测和我一样好”。不要将它作为注释加入,请实际**编辑**您的问题,其余代码在这里介绍。谢谢;) – jmort253