Skip to content

Instantly share code, notes, and snippets.

@spnkr
Created July 4, 2014 23:47
Show Gist options
  • Save spnkr/7183cca5feef523d6e24 to your computer and use it in GitHub Desktop.
Save spnkr/7183cca5feef523d6e24 to your computer and use it in GitHub Desktop.
BW::UIAlertView with a text field, password field, or both
https://github.com/rubymotion/BubbleWrap
``` ruby
#options
opts = {
title:"A question",
message:"A description.",
buttons:["Cancel","Okay!"],
cancel_button_index:0
}
#make an alert view with one plain text field
alert = BW::UIAlertView.plain_text_input(opts).on_click do |al|
user_typed_this_text = al.plain_text_field.text
if al.clicked_button.index==0
#clicked the Cancel button
else
#clicked the Okay! button
end
end
# show it
alert.show
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment