Iphone 如何阻止UIWebView立即加载URL?
我想停止UIWebView的网页加载,同时将另一个URL传递给它进行加载。您应该实现:Iphone 如何阻止UIWebView立即加载URL?,iphone,objective-c,uiwebview,Iphone,Objective C,Uiwebview,我想停止UIWebView的网页加载,同时将另一个URL传递给它进行加载。您应该实现: [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; - (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNa
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]];
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType
UIWebViewDelegate
协议的方法,并为所有不想加载的url返回NO
例如:
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
if ([[inRequest URL] isEqual:someMyUrl]) {
return YES;
}
return NO;
}
你应该实施:
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType
UIWebViewDelegate
协议的方法,并为所有不想加载的url返回NO
例如:
- (BOOL)webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
if ([[inRequest URL] isEqual:someMyUrl]) {
return YES;
}
return NO;
}