2. 打開DLIViewController2.xib檔,加入WebView物件。
3.增加Referencing Outlet。
4.程式列表
//
// DLIViewController2.m
// tableView
//
// Created by Lin Cheng-Min on 12/11/3.
// Copyright (c) 2012年 Lin Cheng-Min. All rights reserved.
//
#import "DLIViewController2.h"
@interface DLIViewController2 ()
@end
@implementation DLIViewController2
@synthesize webView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
5. 執行結果
沒有留言:
張貼留言