Reference: http://stackoverflow.com/questions/6735968/ios-uitextfield-in-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 );
}
No comments:
Post a Comment