Display Map in iPhone

In this application we will see how to display Map in the iPhone. This is the very simple application. Just have a look.

In this application we will see how to display Map in the iPhone. This is the very simple application. Just have a look.

Step 1: Create a View Base applicationusing template. Give the application name “MapDisplay”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: In the WebViewController.h file we have added UIWebView for displaying the web page. So make the following changes in the file.

@interface MapDisplayViewController : UIViewController {
   IBOutlet UIWebView *mapDisplay;
 }
  @property(nonatomic ,retain) UIWebView *mapDisplay;

Step 4: Double click your MapDisplayViewController.xib and open it to the Interface Builder. Open the view window drag WebView from the library and place it to the view window.Drag from the File’s Owner icon to the webView and select mapDisplay and connect File’s Owner icon to the View icon. Now save the MapDisplayViewController.xib file and go back to the Xcode.

Step 5: Make the following changes in the MapDisplayViewController.m file.

- (void)viewDidLoad {
       
   NSString *urlAddress = @"http://maps.google.co.in";
   NSURL *url = [NSURL URLWithString:urlAddress];
   NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
   [mapDisplay loadRequest:requestObj];
   [super viewDidLoad];
}

Step 6: Now compile and run the application.

You can downloaded SourceCode from here MapDisplay 2

WP Greet Box icon
Hello there! If you are new here, you might want to subscribe to the RSS feed for updates on this topic, and free programming tips and tricks and source code            snippets.

Leave a Reply

Security Code:

learn iphone programming

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Our Mobile Training Courses

EDUmobile.ORG offers the following 4 Mobile Training Courses. Our iPhone Training Course is very popular, with over 200 developers in training.

learn iphone programming
© 2010 EDUmobile.ORG