2010-10-04 16 views
37

¿Hay alguna manera de ocultar UIAlertView mediante programación? De hecho, he agregado un UITextField en UIAlertView y quiero realizar la misma operación que cuando presiono el botón "Ok" cuando un usuario pulsa la tecla de retorno del teclado.¿Ocultar UIAlertView programmatically?

Respuesta

81

llamada

[theAlertView dismissWithClickedButtonIndex:0 animated:YES]; 

cuando manipule la tecla de retorno.

+1

Gracias por esto. Si lo quiere un poco más flexible, también podría decir '[theAlertView dismissWithClickedButtonIndex: theAlertView.cancelButtonIndex animated: YES];' o '[theAlertView dismissWithClickedButtonIndex: theAlertView.firstOtherButtonIndex animated: YES];' para hacer clic en el primer botón no cancelar. – palme