Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View...
-
Upload
pierce-harris -
Category
Documents
-
view
218 -
download
0
Transcript of Create a Web View App Step-by-Step. Step 1 Create a new project in XCode using the "Single View...
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
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.
Step 4Open ViewController.m
• In viewDidLoad we will create a URL request object and load the request in the UIWebView.
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];}
Step 5
• Compile your application and run in the Simulator.