IOS-简单WebView的使用

时间:2014-05-01 15:13:29   收藏:0   阅读:420

//要实现UIWebViewDelegate代理

@interface TestViewController : UIViewController<UIWebViewDelegate>

{

    UIWebView *protWebView;

}

@property (retain, nonatomic) IBOutletUIWebView *protWebView;


@implementation TestViewController

@synthesize protWebView;


- (void)viewDidLoad

{

    NSLog(@"viewDidLoad");

    [superviewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

NSURL *url = [[NSURL alloc]initWithString:@"http://www.baidu.com"];

    [protWebViewloadRequest:[NSURLRequestrequestWithURL:url]];  

}

//几个代理方法

- (void)webViewDidStartLoad:(UIWebView *)webView{

    NSLog(@"webViewDidStartLoad"); 

}

- (void)webViewDidFinishLoad:(UIWebView *)web{

    NSLog(@"webViewDidFinishLoad"); 

}

-(void)webView:(UIWebView*)webView  DidFailLoadWithError:(NSError*)error{

    NSLog(@"DidFailLoadWithError");

}

IOS-简单WebView的使用,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!