我使用 AlertView 来提示用户 ID 和密码。当用户在用户 ID 文本字段或密码文本字段中单击时,会弹出键盘,这很好。但我的问题是,当我尝试使用该键盘输入文本时,文本字段中没有显示字母。IT 发生在 iphone 模拟器中。有什么解决办法。如果有人知道,请通知我。非常感谢。
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"User Login" message:@"Please Enter the Following\n\n\n\n" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:@"Sign In", nil];
//UITextField *txtUserName;
//UITextField *txtPassword;
txtUserName = [[UITextField alloc] initWithFrame:CGRectMake(60, 75, 160, 25)];
txtUserName.tag = 3;
txtUserName.borderStyle = UITextBorderStyleBezel;
txtUserName.textColor = [UIColor whiteColor];
txtUserName.font = [UIFont systemFontOfSize:12.0];
txtUserName.backgroundColor=[UIColor whiteColor];
txtUserName.placeholder = @"User ID";
//txtUserName.userInteractionEnabled=YES;
[alert addSubview:txtUserName];
txtPassword = [[UITextField alloc] initWithFrame:CGRectMake(60, 110, 160, 25)];
txtPassword.tag = 3;
txtPassword.borderStyle = UITextBorderStyleBezel;
txtPassword.textColor = [UIColor whiteColor];
txtPassword.font = [UIFont systemFontOfSize:12.0];
txtPassword.backgroundColor=[UIColor whiteColor];
txtPassword.placeholder = @"Password";
[alert addSubview:txtPassword];
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 40.0);
[alert setTransform:myTransform];
alert.tag=3;
[alert show];
[alert release];
[txtPassword release];
[txtUserName release];