I’m trying to develop an application and am stuck at this specific part. I was previously taking a different approach through a web form displayed in UIWebView, but was having issues getting it to open how I wanted. I changed the UI and would now like to take this approach:
Background
User needs to be able to get directions to a specific shop location. The UI contains an instance of UIText Field and a round rect button. The User should be able to click the button and the default Maps application will pop up for the user.
How I imagine this being coded:
1) User enters address in textField
– textField stores address as variable (%var%)
2) User presses Go button
– Button adds variable (%var%) from textField to URL string (see below)
– Button submits full URL to be opened in Safari
3) Safari opens request in Maps application
Image Example of UI: http://i55.tinypic.com/vnjc41.jpg
http://maps.google.com/?saddr=
%var%&daddr=123+Road+St%2C+Town%2C+CA+90210&hl=en
Found a better way to do this using a button to open the maps application:
-(IBAction)hbgdirButton:(id)sender{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”http://maps.google.com/maps?q=Harrisburg+PA&hl=en”]];
}