多个 UIWebViews,我如何跟踪两者的 webViewDidFinishLoad? [英] Multiple UIWebViews, how do I track webViewDidFinishLoad for both?

查看:42
本文介绍了多个 UIWebViews,我如何跟踪两者的 webViewDidFinishLoad?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过了:

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

}
- (void) webViewDidFinishLoad:(UIWebView *)webView2{

}

错误是我无法重新定义相同的方法.

Errors are that I can't redefine the same method.

如果我必须使用相同的方法,我需要想办法从另一个 webView 中识别出一个 webView,我该怎么做?

If I have to use the same method, I need to figure out some way of identifying one webView from the other, how would I do this?

干杯

推荐答案

- (void) webViewDidFinishLoad:(UIWebView *)webview{
     if ( webview == self.webview1 )
     {
          // in case of webview 1
     } else if ( webview == self.webview2 ) {
          // in case of webview 2
     } else {
          NSLog(@"webview %@ was not wired to a property of %@",webview,self);
     }
}

并将 webview1 和 webview2 作为属性添加到您的控制器.(即您需要@property 行和@synthesize 行)

and add webview1 and webview2 as properties to your controller. (i.e. you need the @property line and a @synthesize line)

这篇关于多个 UIWebViews,我如何跟踪两者的 webViewDidFinishLoad?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆