我有一个弹出窗口,它接受 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/