[英]How to invoke the UIWebview's delegate method?
the Question : 问题:
how to invoke the UIWebview's delegate method 如何调用UIWebview的委托方法
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType
Please show me all of the trigger 请向我展示所有触发条件
If you have set your UIWebView to an IBOutlet, you can do this in your viewDidLoad:
method: 如果已将UIWebView设置为IBOutlet,则可以在
viewDidLoad:
方法中执行此操作:
myWebView.delegate = self
Then, whenever anything happens in the web view, your delegate method in your view controller will be called. 然后,无论何时在Web视图中发生任何事情,都将调用视图控制器中的委托方法。
First Step 第一步
@interface ViewController ()<UIWebViewDelegate>
@end
then set Delegate of your UIWebview
to self 然后将您的
UIWebview
Delegate设置为self
self..webview.delegate = self
then implement method you need 然后实现你需要的方法
您可以为webview创建和IBOutlet,并可以像self.webview.delegate=self
那样设置它的委托,也可以通过在UI Builder中单击并从UIWebview拖动到视图控制器上的Yellow图标来设置委托。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.