OK After a ton of digging, here is the result.
Firstly, putting in 'UITextField UIAlertView' into SO's search returns dozens of hits.
It turns out there is a method for doing this, Need new way to add a UITextField to a UIAlertView but it is private API :|
Pretty much every other solution involves hacking a UIAlertView, which is ugly:
http://junecloud.com/journal/code/displaying-a-password-or-text-entry-prompt-on-the-iphone.html
http://iphone-dev-tips.alterplay.com/2009/12/username-and-password-uitextfields-in.html
https://github.com/josecastillo/EGOTextFieldAlertView/
How to move the buttons in a UIAlertView to make room for an inserted UITextField?
^ MrGando's answer is neat
http://iphonedevelopment.blogspot.com/2009/02/alert-view-with-prompt.html
Getting text from UIAlertView
The only proper solution I found (ie coding from scratch from a UIView) is here: https://github.com/TomSwift/TSAlertView
This is all it takes:
- (IBAction) importTap
{
TSAlertView* av = [[[TSAlertView alloc] init] autorelease];
av.title = @"Enter URL";
av.message = @"";
[av addButtonWithTitle: @"Ok"];
[av addButtonWithTitle: @"Cancel"];
av.style = TSAlertViewStyleInput;
av.buttonLayout = TSAlertViewButtonLayoutNormal;
av.delegate = self;
av.inputTextField.text = @"http://";
[av show];
}
// after animation
- (void) alertView: (TSAlertView *) alertView
didDismissWithButtonIndex: (NSInteger) buttonIndex
{
// cancel
if( buttonIndex == 1 )
return;
LOG( @"Got: %@", alertView.inputTextField.text );
}
and Presto!
textfield.text
or am I not understanding you right? – Thomas K