How I get direction in my iPhone apps
can anyone tell me how can I add direction to my iPhone apps. I tried google a开发者_开发问答pi v3, but failed to show direction because it returns to the html. I also tried cloud made SDK, but in free registration they show advertise. I also tried route-me, But they did not give any good solution about this. So how can I show direction in my iPhone apps?
The Google Directions API returns a JSON or XML response. That response will contain one or more legs, each leg will contain one or more steps. Steps come complete with a start and end geolocation, expressed as latitude and longitude. Steps are defined right at the bottom of the document, but clearly include what you want amongst other bits.
Probably the easiest thing assuming no additional libraries available is to request an XML response and write a quick use of NSXMLParser to fish out the information you want.
Assuming you're targeting iOS 4.0 or later, you should be able to feed those geolocations into an MKPolyline. That conforms to MKOverlay, so you can add it atop an MKMapView using -addOverlay:.
精彩评论