本文主要是介绍IOS 获取UIWebView加载网页的上的数据实例,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
http://blog.csdn.net/linux_zkf/article/details/7730359
作者:朱克锋
邮箱:zhukefeng@iboxpay.com
转载请注明出处:http://blog.csdn.net/linux_zkf
@interface TestViewController : UIViewController<UIWebViewDelegate>
{
UIWebView *phoneCallWebView;
UIWebView *protWebView;
}
@property (retain, nonatomic) IBOutlet UIWebView *protWebView;
@property (nonatomic, retain) UIWebView *phoneCallWebView;
///写入.m文件 当中
@implementation TestViewController
@synthesize protWebView;
@synthesize phoneCallWebView;
- (void)viewDidLoad
{
NSLog(@"viewDidLoad");
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//
NSURL *url = [[NSURL alloc]initWithString:@"http://www.xxxx.com"];
[protWebView loadRequest:[NSURLRequest requestWithURL:url]];
}
- (void)webViewDidStartLoad:(UIWebView *)webView{
NSLog(@"webViewDidStartLoad");
}
- (void)webViewDidFinishLoad:(UIWebView *)web{
NSLog(@"webViewDidFinishLoad");
}
-(void)webView:(UIWebView*)webView DidFailLoadWithError:(NSError*)error{
NSLog(@"DidFailLoadWithError");
}
//此方法可以获取网页上的数据
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSLog(@"request:%@",[[request URL] absoluteString]);
}
return YES;
}
这篇关于IOS 获取UIWebView加载网页的上的数据实例的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!