title: Call a method from a UIAlertView Button
body: <p>i created an Alert View that ask for some password but i´m wondering how to call a method only when the "Continue" button was clicked?</p>
  
  <p>This is my code:</p>
  
  <pre><code>-(IBAction)setUserAlert:(id)sender{
  
  UIAlertView *setPassword = [[UIAlertView alloc] initWithTitle:@"Insert Password" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Continue", nil];
  
     //The password isn´t visible.
      setPassword.alertViewStyle = UIAlertViewStyleSecureTextInput;
     [setPassword show];
  
      // Call the method that i want to call only after you click "Continue".
      [self displayMessage:(UIButton *)sender];
          }
      }
  </code></pre>
  
  <p>// Enable the button only when the length is >= 6 and password match</p>
  
  <pre><code>-(BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView{
  //Defining the password 
  NSString *password = [[NSString alloc]initWithFormat:@"12345678"];
  UITextField *setPassword = [alertView textFieldAtIndex:0];
  
    if ([setPassword.text length] &gt;= 6 &amp;&amp; [setPassword.text isEqualToString:password]){
      return YES;
    }
  return NO;
  }
  </code></pre>
  
  <p>// Action i want to call, after you click "Continue"</p>
  
  <pre><code>  -(IBAction)displayMessage:(UIButton *)sender{
  
    if ([sender.currentTitle isEqualToString:@"YES"]){
      _user.text = [[NSString alloc]initWithFormat:@"Hola Mony"];
      _imageUser.hidden = YES;
      _goodUser.hidden = NO;
      backgound.hidden = YES;
      yesButton.hidden = YES;
      noButton.hidden = YES;
      _userLabel.hidden =YES;
    }else{
      _user.text = [[NSString alloc]initWithFormat:@"You can´t play"];
      _goodUser.hidden = YES;
      _imageUser.hidden = NO;
      yesButton.hidden = YES;
      noButton.hidden = YES;
      _userLabel.hidden =YES;
     }
  }
  </code></pre>
  
  <p>I think to call "displayMessage" inside this one but i don´t know how to do it or if it´s correct.</p>
  
  <pre><code>-(void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
  {
  // the user clicked one of the OK/Cancel buttons
   if (buttonIndex == 1){
      // call displayMessage,  sends and error.  
   }  
  }
  </code></pre>