An alert view has the clickedButtonAtIndex property. The first clicked button is 0, the next one 1, and so forth. If you conform to the UIAlertViewDelegate protocol you can implement the following method and react to each pressed button accordingly, or simply call a method:
You can also access text fields via the textFieldAtIndex property.
If you’re conforming to the UIWebViewDelegate protocol the webView:didFailLoadWithError: method gets triggered when there has been a problem.
Call it like this and display an error message (in this case a UIAlertView):
This method is also a good opportunity to stop any loading animations you’ve got going.
Here’s how we can create a simple pop-up window via the UIAlertView instance. It can have a title, some info text and several buttons (OK, Cancel, etc). We’ll only deal with one button and not worry about how to read out which button value has been pressed.