问题
My users need to enter latitude and longitude, and of course I need to verify that the values entered are legitimate lat/long value. I'd like to have a keyboard layout that does some of this for me (eliminating alphabetic characters, punctuation, etc, and leaving only the numbers and +/-). The number pad keyboard doesn't seem to do it (missing +/-) and neither do any other keyboard layouts that come with the SDK. Does anyone know if there is a way to provide that capability without doing my own keyboard IME and jailbreaking the phone?
Thanks!
回答1:
I know this is answer is way late, but this topic was still relevant to me. Therefore I have hope the following will help someone who comes across this page.
Bryan S. Gruver posted a full Xcode project that lambdabunny could modify ever so slightly in order to achieve their aim. You can find it here: http://brygruver.squarespace.com/blog/2009/10/1/creating-a-custom-number-pad.html
Update The Squarespace link is now broken. Another option is: https://github.com/lnafziger/Numberpad
回答2:
How about placing a "+/-" button next to your UITextView that would switch the sign of the entered text? Or a "+" button that appears to the left of it that switches the button label from "+" to "-" each time you tap it.
回答3:
You don't have to jailbreak. If you create a view to simulate the keyboard you're still following the SDK rules.
来源:https://stackoverflow.com/questions/921138/iphone-keyboard-layout-for-negative-numbers