How do I set a delegate for my UIWebView to use webViewDidFinishLoad?
How do I set a delegate for my UIWebView to use webViewDidFinishLoad ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In the interface file indicate that you’re interested:
Then in your implementation you’ll add that delegate method:
Obviously SomethingController should be your actual controller, and UIViewController is whatever you’re actually implementing.
This, by the way, is basically how you implement any delegate.
Edit
In a window-based app, assuming your UIWebView is in your app delegate, you just add it to the list of delegates, separated by commas, like this:
You’ll include your webViewDidFinishLoad in the app delegate’s implementation.
Edit 2
Finally, you’ll need to connect your UIWebView to your controller. It’s common to do this in the
viewDidLoadmethod of a UIViewController, with a line like this:This tells the UIWebView where it should send messages.