TextField键盘不显示

时间:2014-09-26 09:15:43

标签: iphone ios7 xamarin.ios xamarin ios8

键盘未出现在模拟器上的文本字段中。

创建文本字段。

    txt_UserName = new UITextField {
        Placeholder = "Enter Username",
        BorderStyle = UITextBorderStyle.RoundedRect,
        Font = UIFont.FromName(Constants.KHELVETIC,Constants.KFontSize12),
        VerticalAlignment = UIControlContentVerticalAlignment.Center,
        AutocorrectionType = UITextAutocorrectionType.No,
        AutocapitalizationType = UITextAutocapitalizationType.None,
        ClearButtonMode = UITextFieldViewMode.WhileEditing,
        LeftViewMode = UITextFieldViewMode.Always,
        ReturnKeyType = UIReturnKeyType.Next,
        BackgroundColor = UIColor.White,
        ShouldReturn = delegate {
            txt_Email.BecomeFirstResponder ();
            return true;
            }
        };


    txt_Email = new UITextField {
        Placeholder = "Enter Email",
        BorderStyle = UITextBorderStyle.RoundedRect,
        Font = UIFont.FromName(Constants.KHELVETIC,Constants.KFontSize12),
        VerticalAlignment = UIControlContentVerticalAlignment.Center,
        AutocorrectionType = UITextAutocorrectionType.No,
        AutocapitalizationType = UITextAutocapitalizationType.None,
        ClearButtonMode = UITextFieldViewMode.WhileEditing,
        KeyboardType = UIKeyboardType.EmailAddress,
        LeftViewMode = UITextFieldViewMode.Always,
        ReturnKeyType = UIReturnKeyType.Next,
        BackgroundColor = UIColor.White,
        ShouldReturn = delegate {
            txt_Password.BecomeFirstResponder ();
            return true;
        }
    };

无法找到支持键盘iPhone-Portrait-PhonePad的5型键盘;使用2870935746_Portrait_iPhone-Complex-Pad_Default

当我选择Textfield时,它会显示上述信息。

1 个答案:

答案 0 :(得分:14)

您需要取消选中硬件键盘选项,以便弹出模拟器上的键盘。 因为如果您有硬件键盘选项,则需要将键盘连接到您的设备以检查它是否正在接受它。