views:

599

answers:

3

hello guys i have a UITableCell which has some details like this "550 Ashbury St., San Francisco, CA, 94117".the details are coming from database.now i want that when i click on the cell a new view should be loaded with google map with this address. any idea how to achieve this???

A: 

The way I have done this to create a simple webpage on my server that sets up google maps and contains a javascript function which takes a location as a string argument. This function is responsible for setting up google maps to show the address.

I then load the page inside a UIWebView and I construct javascript which executes my javascript function with the argument, something like:

NSString* js = [NSString stringWithFormat:@"setup('%@')", location];

Then I execute it using:

[googleMapView stringByEvaluatingJavascriptFromString:js];
freespace
i don't understand your answer could you please post the whole code for this.how do i run javascriptin a native app.i am not building a web application.
Rahul Vyas
Read the documentation for UIWebView.
freespace
A: 

You'll need to geocode the address, to turn it into GPS coordinates, i.e. latitude and longitude. Google is not the only web service to provide this, but you'll likely use some web service for this purpose.

Once you have your coordinates, you can feed them to the MapKit component in the iPhone 3.0 SDK, which you can read more about at Apple Developer Connection.

Alex Reynolds
+1  A: 

Use iPhone OS 3.0 which includes the MapKit framework using Google Maps. You don't need to do the browser way anymore since with MapKit you can embed your own map in the application.

Nael El Shawwa