IOS-简单WebView的使用

//要实现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

IOS-简单WebView的使用

上一篇:[Android学习系列17]Content Provider的一些事


下一篇:iOS7 MPMoviePlayerViewController 横屏显示