Get In Touch
This form does not yet contain any fields.

    Entries in UIAlertView (1)

    Monday
    Nov072011

    Text Input in UIAlertViews

     

    iOS developers have been hacking away at trying to find a good solution for presenting users with a text input on a popup.  Some developers have been successful at getting this to work, but it has never been a pretty or simple solution. iOS 5 provides several simple solutions to this problem with the new UIAlertViewStyles that are now available.

    UIAlertViewStylePlainTextInput is the most simplistic of the new styles and presents a standard UIAlertView with an embeded UITextField.  In order to receive the text input into this UITextField, you must implement the UIAlertViewDelegate method didDismissWithButtonIndex.  A simple example implementation...

    UIAlertViewStyleLoginAndPasswordInput works exactly the same except you receive two text fields for input, the username and password.  Again you can get these contents form the UIAlertViewDelegate method didDismissWithButtonIndex, with the login field having a index of 0 and the password field having an index of 1.