- (BOOL)textFieldShouldReturn:(UITextField *)alertTextField {//add any method you want to execute to here. This method will be called when user taps on the textfield in alertview.
[alertTextField resignFirstResponder];// to dismiss the keyboard.
[alert dismissWithClickedButtonIndex:0 animated:YES];//this is called on alertview to dismiss it.
}