[TIMOB-138] inputs inside alertdialogs
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2011-04-15T02:24:13.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Kevin Holland |
Assignee | Reggie Seagraves |
Created | 2011-04-15T02:24:12.000+0000 |
Updated | 2017-03-09T21:09:40.000+0000 |
Description
I came across something else i use in my obj-c apps that I cant seem to find any documentation about doing with titanium. Input fields inside an alert. I use it for a account register dialog (much easier and imo smoother progression).
here an example of how its done in objective c
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Register Account" message: @"" delegate: self cancelButtonTitle: @"Nevermind" otherButtonTitles: @"Register!", nil];
[alert addTextFieldWithValue: @"" label: @"Email"];
[alert addTextFieldWithValue: @"" label: @"Password"];
[alert addTextFieldWithValue: @"" label: @"Password Confirm"];
emailField = [alert textFieldAtIndex:0];
emailField.keyboardType = UIKeyboardTypeAlphabet;
emailField.keyboardAppearance = UIKeyboardAppearanceAlert;
emailField.autocorrectionType = UITextAutocorrectionTypeNo;
emailField.autocapitalizationType = UITextAutocapitalizationTypeNone;
passwordField = [alert textFieldAtIndex:1];
passwordField.clearButtonMode = UITextFieldViewModeWhileEditing;
passwordField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
passwordField.keyboardAppearance = UIKeyboardAppearanceAlert;
passwordField.autocorrectionType = UITextAutocorrectionTypeNo;
passwordField.secureTextEntry = YES;
passwordField2 = [alert textFieldAtIndex:2];
passwordField2.clearButtonMode = UITextFieldViewModeWhileEditing;
passwordField2.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
passwordField2.keyboardAppearance = UIKeyboardAppearanceAlert;
passwordField2.autocorrectionType = UITextAutocorrectionTypeNo;
passwordField2.secureTextEntry = YES;
[alert show];
[alert release];
any chance we might see this in the future as well?
Attachments
File | Date | Size |
---|---|---|
register.jpg | 2011-04-15T02:24:12.000+0000 | 51251 |
Part of the problem is that the -[UIAlertView addTextFieldWithValue:label:] and -[UIAlert textFieldAtIndex:] are currently undocumented/private APIs, and the use of it could result in App Store rejections. There's another trick that's just as hairy which involves blindly stabbing UITextFields into the view that is UIAlertView.
That's unfortunate. I've seen apps on the appstore that employ this method, but you know how crappy apples policies are... they could get pulled tomorrow, or never. :(
Tell me about it. My 'favorite' is when you release 2.0, which has x new feature and gets approved, then you do an important bugfix to 2.0.1, and it's rejected for the x which was in 2.0. Given the trouble Apple gave PhoneGap early on, Titanium was designed to stay as safely inside the lines as possible.
The Apple guidelines themselves say, 'don't put text fields in alerts, use modal fullscreen pages for it'. The fact that Apple themselves do it (Safari and app store) and have such a nice interface for it makes this even more annoying.
In the mean time, the solution is to create a window with a web view with the text fields and buttons, and have window.open({modal:true}) so the window is brought up from the bottom. It's not as pretty, but it's kosher and it's here now.
--Edit: My bad. I can't recall, but I think the {modal:true} functionality is coming out in 0.7.
No longer holding breath for Apple to share their toys with others. Until they do, we might as well close this one. Since it was never resolved, it'll have to be marked invalid.
This is really something I been wishing for a long long time. Any way someone can make this thing as a module so its optional? I want to test it with an app and see if it gets rejected!
This is really something I been wishing for a long long time. Any way someone can make this thing as a module so its optional? I want to test it with an app and see if it gets rejected!
Closing ticket as invalid.