In Code I am Using Decimal type keyboard on a text field to enter decimal number. But when I change the phone country/language in phone settings from to Spain then my Decimal keyboard gets changed. The decimal (.) button converting to (,) and hence user unable to enter decimal point.
I Want that my keyboard should not change with phone country language getting change. Keyboard local should always be English(US) "en_US". Please help.
Related
I am new to Swift and this is my first application. I essentially want a user to enter two numbers, that I can use for some calculations. For the text fields I used the option "Decimal Pad" as keyboard type. With the simulator it works well - on my phone, however, the dot is shown as a comma, which causes the app to crash. Is there an easy fix for this problem? I don't want any global changes for the location or the keyboards used, but just a fixed decimal pad with dot instead of comma.
Thank you!
When you choose Keyboard Type, sometimes appear as in Figure 1 and another as in Figure 2 ,,,
What is the reason?
Figure 1 :-
Figure 2 :-
I want as in the first form all my applications.
in addition to tomsterritt answer, decimal pad can differ between the device languagem for example in a english keyboard the decimal will be a point "." , while in a brazilian portuguese keyboard the decimal will be ",".
try changing languages and see for yourself.
The examples you've added are from different versions of iOS - the system style of the decimalPad keyboard type has changed over time.
If you want a non-system keyboard style you can implement your own. Your desired style should not be too difficult as it has a fairly basic layout & functionality.
I'm worked on a custom keyboard and Apple review team rejected it because the keyboard does not support 'Numbers and Decimals' types.
So, I found that the problem is that when a text field requires those specific type of keyboard (for example to inset age, measures, or other numeric values), my keyboard 'misses to respond'.
I understood, reading from Apple documentation, that you must respond to the UIKeyboardTpye property per text object's.
I searched for specific delegate of the UIInputViewController but I wasn't able to find something close to that.
In this forum I found that one good place to examine the current keyboard type required is the textDidChange: delegate, but, it is not called.
I suppose this responder is called when your keyboard, somehow, 'declares' to iOS that it can handle Numbers or Decimal types. In fact I created a simple app with a simple UITextView that requires the Decimal keyboard type:
textView.keyboardType = UIKeyboardTypeDecimalPad;
And I put a NSLog() in the keyboard extension Input View Controller textDidChange: delegate.
As I tap on the text view my delegate is not called, instead the standard Decimal keypad is shown and in the Xcode console I see the following message:
Can't find keyplane that supports type 8 for keyboard iPhone-Portrait-DecimalPad; using 405786210_Portrait_iPhone-Simple-Pad_Default
I noticed also that this message comes when the UITextView requires the not-allowed keyboard types, i.e. the phonepad. All other keyboard types do not issue that message and the custom keyboard is shown and the textDidChange: delegate is correctly called.
The Numbers and Decimal types are surely allowed and are a MUST for the review team guys. Why the behave as a forbidden-types?
I think we need to 'declare', for example in the info.plist that our extension supports various keyboard types, but... well or more simply... I do not get the point... so... I'm asking... How can I add multiple keyboard types to my keyboard extension??
Thank you very much for help!
After the second rejection of my keyboard extension they sent me a screenshot. I noticed that they, generally, test apps on iPad. This made me think.
After some test it came out that the Numbers and Decimal types do not respond the same way on iPhone and iPad.
On iPhone a text view requiring Numbers or Decimal type keyboard always shows the iOS keypad, i.e. the custom extension is not called.
On the other side, on the iPad a text view requiring Numbers or Decimal type keyboard activates the custom extension.
Finally, after provided a standard numeric keypad (even if my keyboard uses hand-written techniquies) it was approved.
After updating to Xcode 5.0.2, it seems that iOS simulator custom location option is not working propertly. When I prompt this
And reopen again the custom location dialog
I end getting the lat/lon values without decimals. Also, if I prompt a . instead of a comma, some times the dialog replaces the point with a comma, and sometimes deletes the decimal values. I've tried closing the simulator, changing hardware and restarting Xcode with no results.
There is a bug in the modal "Custom Location" window of iOS Simulator that affects users who have the comma set as the decimal number separator.
If you type the coordinates with the format XX,XX and you press OK, the numbers after the comma are truncated.
Try inputing both coordinates with the format XX.XXX ( 2 digits + a point (.) + 3 digits) then press OK, then quit the iOS Simulator. When you launch it again, it'll have the desired location.
If you go to the same "Custom location" windows you are going to visualize the coordinates in format XX,XX, but DO NOT PRESS OK in that windows, just press Cancel, because if you press OK they will be truncated again.
You can use this Macro #if (TARGET_IPHONE_SIMULATOR) and manually set a custom location in your code.
Hope it helps
It seems that the iOS Simulator is accepting only decimals with dot instead of comma.
For your language (spanish, I think), the Mac OS put comma in decimal numbers. I had the same problem because my Mac OS is in portuguese, that uses the comma as default for decimal numbers.
To change this setting, go to System Preferences > Language & Region > Advanced... and change the Decimal value in the number separators from comma (,) to dot (.) (you can change the currency separators if you want).
Than, every time you open the custom location prompt, decimal numbers of lat/lon values will appear with dot instead of comma.
I hope it has helped you, I couldn't post images because of my poor reputation.
In Xcode,Product -> Scheme -> Edit Scheme... (command + <).
Select Run/Debug from Side Menu, options tab Select "Allow Location Simulation" and select a default location to none. The default location is the reason for custom location changing.
Set your custom Lat/Long to Simulator...
On the iOS platform, I have a UITextField where I am using the ASCII keyboard layout. I notice (like the keyboard works in other apps) that when I type space + space, a period '.' is inserted into the text field. This is all normal iOS stuff...
But can I configure the text field or the keyboard somehow so that this "two spaces == period" behavior is turned off?
One possible solution (albeit not a perfect one) has been posted here ... http://www.mailinglistarchive.com/phoenix-iphone-developer-group#googlegroups.com/msg00037.html