键盘没有显示

时间:2013-10-04 21:10:01

标签: ios ios7 uialertview uikeyboard

我有一个应用程序,提示用户通过弹出文本框输入密码。键盘没有像以前版本的iOS那样显示文本框。希望有人能指出我正确的方向。我相信这是处理密码输入功能的代码片段。

- (void)showPreferencesPasswordPrompt {
InputAlertView * inputAlert = [[InputAlertView alloc] initWithTitle:NSLocalizedString(@"browser_preferences_password_alert_title", nil)
                                                            message:NSLocalizedString(@"browser_preferences_password_alert_message", nil)
                                                           delegate:self
                                                  cancelButtonTitle:NSLocalizedString(@"cancel", nil)
                                                  otherButtonTitles:NSLocalizedString(@"ok", nil), nil];

inputAlert.tag = PREFERENCES_PASSWORD_TAG;
inputAlert.textField.secureTextEntry = YES;

[inputAlert show];
[inputAlert release];

}

2 个答案:

答案 0 :(得分:2)

我知道这个问题已经超过一年了,但我遇到了同样的问题而且我的解决方案可能会帮助其他人。在我的情况下,无意中打开了模拟器上的设置:硬件>键盘>连接硬件键盘

取消选择此设置后,虚拟键盘开始按预期显示。

答案 1 :(得分:1)

AlertViews需要使用ios 7设置不同的文本字段。具体如下:

    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:nil message:NSLocalizedString(@"Rename List", @"Rename List") delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel") otherButtonTitles:NSLocalizedString(@"OK", @"OK"), nil];
    alert.alertViewStyle = UIAlertViewStylePlainTextInput;
    alertTextField_ = [alert textFieldAtIndex:0];
    alertTextField_.keyboardType = UIKeyboardTypeAlphabet;
    alertTextField_.placeholder = list.name;
    [alert show];
    [alertTextField_ becomeFirstResponder];
相关问题