WebView Application In iPhone

In this application we will see how to WebView display in the view window . So let see how it will worked.

Step 1: Open the Xcode, Create a new project using View Base application. Give the application “MapViewiPhone”.

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: Expand classes and notice Interface Builder created the ViewController class for you. Expand Resources and notice the template generated a separate nib, MapViewiPhoneViewController.xib for the MapViewiPhone application.

Step 4: We need to add MapKit.framework in the Frameworks folder.

Step 5: Open the MapViewiPhoneViewController.h file and make the following changes:


#import <uikit/UIKit.h>
#import <mapKit/MapKit.h>
@interface MapViewiPhoneViewController : UIViewController {

IBOutlet MKMapView *map;

@property(nonatomic, retain) IBOutlet MKMapView *map;



Step 6: Double click the MapViewiPhoneViewController.xib file and open it to the Interface Builder. First drag the mapview from the library and place it to the View window. Connect File’s Owner icon to the view window and select map. Now save the .xib file, close it , and go back to the Xcode.

Step 7: Open the MapViewiPhoneViewController.m file and make the following changes:


#import "MapViewiPhoneViewController.h"
@implementation MapViewiPhoneViewController

@synthesize map;

- (void)dealloc
[super dealloc];

- (void)didReceiveMemoryWarning

[super didReceiveMemoryWarning];

#pragma mark - View lifecycle
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
[super viewDidLoad];

map.mapType = MKMapTypeSatellite;


- (void)viewDidUnload
[super viewDidUnload];


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);



Step 8: Now compile and run the application on the Simulator.

You can Download SourceCode from here MapViewiPhone

Leave a Comment:

15 iPhone Application Development Tutorials Worth Checking Out says November 1, 2011

[…] In this application we will see how to WebView display in the view window. Website […]

21 Useful iPhone Development Apps Tutorial as your References : Daily Syntax says April 13, 2012

[…] 12. WebView Application in iPhone […]

Jorge Silva says April 13, 2012

I am working on an app that uses multiple buttons to open different URLs within the same UIWebView. I keep getting the same URL, do you have any guidance to this respect?? I would appreciate it very much. Thanks.

Add Your Reply