Last active
March 17, 2016 06:12
-
-
Save dbankier/4615745 to your computer and use it in GitHub Desktop.
Adds `keyboardType` and `hintText` to PLAIN_TEXT_INPUT AlertDialog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// So you can do this: | |
var dialog = Ti.UI.createAlertDialog({ | |
title: "Business Number", | |
style: Ti.UI.iPhone.AlertDialogStyle.PLAIN_TEXT_INPUT, | |
keyboardType: Ti.UI.KEYBOARD_PHONE_PAD, | |
hintText: "Enter Phone Number", | |
buttonNames: ['OK'] | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credits