Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 UITextField 来获取价格字段的输入。因为它是为了价格,所以我想为一个小键盘和一个十进制按钮制作一个自定义键盘。我有键盘视图设置,但是,我不知道如何完全禁用默认的 iphone 键盘。有任何想法吗?
[yourTextField setInputView:yourKeyPadView];
您可以继承UITextField和覆盖canBecomeFirstResponder. 返回NO,它永远不会放键盘。但是,您需要负责处理触摸,以便您可以启用/禁用自己的键盘。这可能会影响剪切/复制/粘贴行为,因此请考虑您是否真的想要这样做。
UITextField
canBecomeFirstResponder
这可以在 Interface Builder 中完成:
选择数字和标点