Interesting project, I was shocked to find out how difficult doing map
overlays is going to be. I wonder how yelp did it? Looks like they
might have just brought in a static map page as an image and overlaid
on top of it. It works, but im looking for more...
2 Questions:
1. Think it is possible to load a bunch of markers into the maps
UIWebView? Im new to this project, not sure how difficult that would
be.
2. Think there is anyway to listen in objective-c to have the iphone
application react to user clicks on the markers?
On another note, I'm still finding it to be slugging when deployed on
an iPhone. Can anyone think of anything that would help improve
performance? I find when comparing the functionality to something
like Loopt, it's just really slow, and zoom in or out aren't very
respondent.... on the simulator of course everything looks great.
Jordan
I have the javascript/html rendering such that when you click on the
balloon in a normal browser, it shows a balloon which was tied to the
marker, and in that balloon, there are html links.
Using the MapView component, all the balloons (GMarker objects) render
on the map just fine.
But when I tap on a balloon, the click event doesn't get sent to the mapview.
Do you, or does anyone know how to make the tap or click events go to
the browser or UIWebView so that the javascript that is already there
will work as it does in a browser for marker html?
For others trying to render markers, I added the following javascript
to the source code which is now being returned by my server of
course...
My marker javascript code looks like:
function addMarker(lat, lon, markerTitle, color, timeStamp) {
var point = new GLatLng(lat, lon);
if (color == 'green') {
markerOptions = { title:markerTitle, icon:green };
} else {
markerOptions = { title:markerTitle, icon:red };
}
var marker = new GMarker(point, markerOptions);
map.addOverlay(marker);
points.push(point);
GEvent.addListener(marker,'click', function() {
var bubbleHtml = markerTitle + "<br/>" + timeStamp
+ "<br/>";
bubbleHtml += "<a
href='http://maps.google.com/maps?q=" + lat + "," + lon + "'>map</a>";
map.openInfoWindowHtml(point, bubbleHtml);
});
}
Jordan
I *think* I understand what you are saying to try...
So, I added these methods to the MapWebView class:
- (void) platformTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
[super touchesBegan:touches withEvent:event];
}
- (void) platformTouchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
[super touchesEnded:touches withEvent:event];
}
then, I added code
to the MapView class to bubble up these events...
switch ([touches count]) {
case 1: {
// potential pan gesture
-----------> [mMapWebView platformTouchesBegan:touches
withEvent:event];
UITouch *touch = [[touches allObjects] objectAtIndex:0];
[self setPanningModeWithLocation:[touch locationInView:self]];
} break;
but, this just crashes each time I try a click or a tap.
hitTest is no longer in the project, so I didn't know what you meant
when you referenced hitTest...
I don't think I'm understanding. It makes sense to try to bubble up
the events to the UIWebView, but I *think* that is what I tried.
thanks for anymore guidance.
Jordan
Too many markers also seem to crush performance...we are switching
gears now to overlay our own native markers.
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {... switch ([touches count]) {... case 1: {//See I added this here:... [mMapWebView.privateWebDocView touchesBegan:toucheswithEvent:event]; //<--
Can you paste the specific code you have added to bubble up the events please?
thanks so much.
Jordan