Multiple keyboards appear in iPhone notification dialog?

I am setting up a warning with a text box so that players can enter their name for a high score. The game is oriented in landscape mode, but when I call to show a warning, the warning appears in portrait mode while two keyboards are displayed, one in landscape and one (landscape size one) in portrait mode. Here is the code I use to configure the warning dialog:

UIAlertView* dialog = [[[UIAlertView alloc] init] retain]; [dialog setDelegate:self]; [dialog setTitle:@"Enter Name"]; [dialog setMessage:@" "]; [dialog addButtonWithTitle:@"Cancel"]; [dialog addButtonWithTitle:@"OK"]; [dialog addTextFieldWithValue:@"name" label:@""]; CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0, 100.0); [dialog setTransform: moveUp]; [dialog show]; [dialog release]; 

How to make a notification in landscape orientation and not show two keyboards?

Thanks Ben

+4
source share
1 answer

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.

+2
source

All Articles