Iphone 如何阻止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

我想停止UIWebView的网页加载,同时将另一个URL传递给它进行加载。

您应该实现:

[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;
}