For those who can take care of this, here is a working solution that works fine in landscape mode:
UIAlertView* dialog = [[[UIAlertView alloc] init] retain]; [dialog setDelegate:self]; [dialog setTitle:@"Enter Name"]; [dialog setMessage:@" "]; [dialog addButtonWithTitle:@"Cancel"]; [dialog addButtonWithTitle:@"OK"]; nameField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)]; [nameField setBackgroundColor:[UIColor whiteColor]]; [dialog addSubview:nameField]; CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0, 100.0); [dialog setTransform: moveUp]; [dialog show]; [dialog release]; [nameField release];
Make sure you create a UITextField * nameField; in the .h file, then you can get the text entered by the user by following these steps: inputText = [nameField text];
in the alert alert (alert): (UIAlertView *) clickedButtonAtIndex: (NSInteger) buttonIndex.
source share