Restrict iOS keyboard input to integer?

sparkersparker Member Posts: 47
edited November -1 in Working with GS (Mac)
Hi all,

I'm trying to work out how I can restrict the new feature "Keyboard Input" on my iphone game to only accept a whole number? Even if I set the 'Change Attribute' field to something like an integer, it seems to happily accept anything typed in there.

Ideally, if I could restrict it at the time of entering that would be best, but even if it let the user input whatever they wanted, ran a quick test to see if it was an integer and then gave them an error or prompt would also be fine. Is there any way to test what is saved in attributes?

Regards,
Sam

Comments

  • bradhermanbradherman Member Posts: 55
    I do this in my app ANC Calc in the app store.
    You need 2 attributes to make it work with the method I worked out.

    First one is a text, second one is an int, pop up the keyboard with it set to change the string. Then check if the string changes and try and change attrib the int To the string attrib. If it's a valid whole number it will be set correctly, if not you get 0.
Sign In or Register to comment.