Question: I am using a `UIAlertView` to prompt users for a password. If the password is correct, I'd like the alert view to go away normally; if the password is incorrect, I'd like the alert view to remain (with the text changed to something like "Please try again."). How do I alter the default behaviour so that the view doesn't go away when a button is pressed?

I've tried the subclassing method suggested at [Is it possible to NOT dismiss a UIAlertView](https://stackoverflow.com/questions/2051402/is-it-possible-to-not-dismiss-a-uialertview), but the `dismissWithClickedButtonIndex` wasn't being called in my subclass. After reading the documentation I see that subclassing `UIAlertView` isn't supported, so I'd like to try another approach.

If this isn't possible with `UIAlertView`, is the best option to simply make a password view from scratch? Thanks for reading.

Answer: 
As this is very old question,but I got one solution and though of posting if any other developer need in near future.

Implement protocol methods in .h file

In order to respond to button taps in our UIAlertView, we will use the – alertView:clickedButtonAtIndex: protocol method as

```
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{

}
//Now below code will check if uitextfield value.
- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView
{
    NSString *inputText = [[alertView textFieldAtIndex:0] text];
    if( [inputText length] > 0)
    {
       //text field value is greater than zero ,then Done button will appear as blue,or else it will be blurred
        return YES;
    }
    else
    {
        return NO;
    }
}

```
It's not possible to leave the alert there when a button has been clicked.

You can either disable the "OK" button by delegate method `alertViewShouldEnableFirstOtherButton:`, if you are checking the password locally, or just show another alert later. The second alert can contain a different information, e.g. "Password incorrect" instead of "Enter password".