UITextField 属性 KeyboardType 未按预期显示
我有一个接受 UITextField 输入的弹出窗口。根据输入,我设置属性:text、keyboardType、returnKeyType 和 KeyboardAppearance。 text 和 returnKeyType 属性反映在弹出窗口中。但我得到一个标准键盘,显示数字(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 上进行过测试。
另一种选择可能是在弹出窗口中添加数字或数字+小数键盘,但我不知道从哪里开始使用此选项。
I have a popover that accepts input into a UITextField. Depending on the input, I set the properties: text, keyboardType, returnKeyType, and keyboardAppearance. The text and returnKeyType properties are reflected in the popover. But I get a standard keyboard, with numbers (UIKeyboardTypeNumberPad, UIKeyboardTypeDecimalPad) or letters (UIKeyboardTypeDefault) showing. I expected to see the "enter pin" keyboard for UIKeyboardTypeNumberPad and numbers with a period for the UIKeyboardTypeDecimalPad keyboardType.
My code...
.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;
Am I missing something to change the keyboardType? I am currently running this on an iPad. I have not tested on an iPhone.
Another option might be to add a numeric or numeric+decimal keypad to the popover, but I do not know where to start on this option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iPad 没有小键盘。所以它会显示普通的数字键盘。
The iPad has no keypad keyboard. So it shows you the normal number keyboard instead.