xcode iphone:如何在数字键盘(数字键盘)中添加冒号(:)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8601902/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iphone:how to add colon(:) in number pad(numeric keyboard)?
提问by iPhone
I want to add time in my textfield and for that as per client's requirement I take a numberpad(numeric keyboard) but in number pad there is no option for colon(:) and to show the time in min:sec colon(:) is required.
我想在我的文本字段中添加时间,根据客户的要求,我使用数字键盘(数字键盘),但在数字键盘中没有冒号(:) 选项,并以分钟:秒冒号(:) 显示时间必需的。
then how can I add colon in number pad?
那么如何在数字键盘中添加冒号?
Do you have any idea?
你有什么主意吗?
采纳答案by Manish Ahuja
you can not add anything to existing keyboards. Best option in this case would be to use UIKeyboardTypeNumbersAndPunctuation
您不能向现有键盘添加任何内容。在这种情况下最好的选择是使用 UIKeyboardTypeNumbersAndPunctuation
[myTimeTextField setKeyboardType: UIKeyboardTypeNumbersAndPunctuation];
UIKeyboardTypeNumbersAndPunctuation has both numbers as well and punctuations (colon included)
UIKeyboardTypeNumbersAndPunctuation 也有数字和标点符号(包括冒号)
回答by user1111278
If you didn't add a button like "Done" to lower left, you can add a ":" button and when user pressed it you can add ":" to the textfield.
如果您没有在左下方添加像“完成”这样的按钮,您可以添加一个“:”按钮,当用户按下它时,您可以在文本字段中添加“:”。
There is an old but useful tutorial about adding a button to Numeric Keyboard http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key
有一个关于向数字键盘添加按钮的旧但有用的教程 http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key