Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Adds `keyboardType` and `hintText` to PLAIN_TEXT_INPUT AlertDialog
// So you can do this:
var dialog = Ti.UI.createAlertDialog({
title: "Business Number",
style: Ti.UI.iPhone.AlertDialogStyle.PLAIN_TEXT_INPUT,
hintText: "Enter Phone Number",
buttonNames: ['OK']
// For SDK 3.0.0 modify TiUIAlertDialogProxy.m at around line 124 to look like this:
if ([TiUtils isIOS5OrGreater])
int style = [TiUtils intValue:[self valueForKey:@"style"] def:UIAlertViewStyleDefault];
[alert setAlertViewStyle:style];
if (style == UIAlertViewStylePlainTextInput) {
int keyboardType = [TiUtils intValue:[self valueForKey:@"keyboardType"] def: UIKeyboardTypeDefault];
NSString *hintText = [TiUtils stringValue:[self valueForKey:@"hintText"]];
UITextField *alertTextField = [alert textFieldAtIndex:0];
alertTextField.keyboardType = keyboardType;
alertTextField.placeholder = hintText;
Copy link

Copy link

Great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment