Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View...

7
Create a Web View App Step-by-Step

Transcript of Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View...

Page 1: Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View Application" option.

Create a Web View App

Step-by-Step

Page 2: Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View Application" option.

Step 1

Create a new project in XCode using the "Single View Application" option.

Page 3: Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View Application" option.

Step 2Modify “viewcontroller.h”

#import <UIKit/UIKit.h>

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

@end

Page 4: Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View Application" option.

Step 3Create the User Interface

• Double click on MainStoryboard.storyboard and open it to Interface Builder.

• Drag "Web View" from the library and place into view.

• Connect the UIWebView code to the Web View GUI.

Page 5: Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View Application" option.

Step 4Open ViewController.m

• In viewDidLoad we will create a URL request object and load the request in the UIWebView.

Page 6: Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View Application" option.

Step 4 – Add the following code- (void)viewDidLoad { NSString *urlAddress = @"http://www.itu.edu";

NSURL *url = [NSURL URLWithString:urlAddress];

NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

[webDisplay loadRequest:requestObj];

[super viewDidLoad];}

Page 7: Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View Application" option.

Step 5

• Compile your application and run in the Simulator.