ios - UITextField 属性 KeyboardType 未按预期显示

标签 ios keyboard uitextfield

我有一个弹出窗口,它接受 UITextField 中的输入。根据输入,我设置属性:text、keyboardType、returnKeyType 和 KeyboardAppearance。 text 和 returnKeyType 属性反射(reflect)在弹出窗口中。但我得到一个标准键盘,显示数字(UIKeyboardTypeNumberPad、UIKeyboardTypeDecimalPad)或字母(UIKeyboardTypeDefault)。我希望看到 UIKeyboardTypeNumberPad 的“输入 pin”键盘和 UIKeyboardTypeDecimalPad 键盘类型的带有句点的数字。

我的代码...

.h:

@interface IFDTextPopoverContentViewController : UIViewController {
UILabel *notes;
UITextField *input;
}

@property (nonatomic, retain) IBOutlet UILabel *notes;
@property (nonatomic, retain) IBOutlet UITextField *input;

.m:

        IFDTextPopoverContentViewController *textPopover = (IFDTextPopoverContentViewController *)textPopoverController.contentViewController;
        textPopover.input.text = [xmlResults valueForKey:question.XmlAttrib];
        textPopover.input.keyboardType = UIKeyboardTypeNumberPad;
        textPopover.input.keyboardAppearance = UIKeyboardAppearanceDefault;
        textPopover.input.returnKeyType = UIReturnKeyDone;
        textPopover.notes.text = question.Notes;

我是否缺少更改键盘类型的内容?我目前正在 iPad 上运行此程序。我还没有在 iPhone 上进行过测试。

另一个选项可能是向弹出窗口添加数字或数字+小数键盘,但我不知道从哪里开始使用此选项。

最佳答案

iPad 没有小键盘。因此它会显示普通的数字键盘。

关于ios - UITextField 属性 KeyboardType 未按预期显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5889549/

相关文章:

iphone - 核心数据轻量级迁移 : Can't find or automatically infer mapping model for migration

java - 使用 keyPressed 检测键盘方向键

ios - 如何在 UILabel 中显示 UITextField 的文本?

ios - 是否可以更改 UITextView 和 UITextField 中单个单词的颜色

ios - 如何通过触摸按钮获取indexPath?

ios - IOS google maps sdk中的自定义信息窗口

ios - 虚拟键盘和我的 UIView 正在发生冲突(不断地互相覆盖)

java - 如何获取全局当前的键盘状态? (即,无论查询应用程序是否具有焦点,当前按下的是哪些键)

swift - 为什么我的渐变层比我应用它的 UITextField 小?

ios - 在 NSView 之上实现 UIView,以便从 iOS 移植到 Mac OSX