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.

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.

 

 

 

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.

 

 

 

Step 6: Now compile and run the application.

You can downloaded SourceCode from here MapDisplay 2

Leave a Comment:

1 comment
Patrick says March 17, 2010

This was great, thanks! I fired up Xcode and got the map (of India) up in about 5 minutes.

A few comments for beginners:
“Step 1: Create a View Base applicationusing template” should be:
“Step 1: Create a View Base application using the template”.

“Step 3: In the WebViewController.h file we have added UIWebView” should be:

“Step 3: In the MapDisplayViewController.h file we have added UIWebView”.

“Step 4: [snip] Drag from the File’s Owner icon to the webView” should be:
“Step 4: [snip] Control-click and drab from the File’s Owner icon to the webView”.

Reply
Add Your Reply