Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6950065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:02:50+00:00 2026-05-27T14:02:50+00:00

According to the UITextInputTraits Protocol Reference , the UIKeyboardTypeDecimalPad is Available in iOS 4.1

  • 0

According to the UITextInputTraits Protocol Reference, the UIKeyboardTypeDecimalPad is “Available in iOS 4.1 and later.”

I am currently using the System Versioning Preprocessor Macros found in How to check iOS version? to check if my app is running in iOS 4.1 and later, but I wonder…

Is there a better way to test for this keypad’s availability? I can’t test for availability of the selector “setKeyboardType”, since that will always return YES. I need to test if one of the UIKeyboardType enums is available for use.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:02:51+00:00Added an answer on May 27, 2026 at 2:02 pm

    Try this:

        yourTextField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
        if (([[[UIDevice currentDevice] systemVersion] doubleValue] >= 4.1)) {
            yourTextField.keyboardType = UIKeyboardTypeDecimalPad;
        }
    

    This is checking the iOS version running on the device to see if it is “new” enough. That is to say, the keypad with a decimal button was available in iOS4.1. So, any iOS version at or after that version has it.

    The technique is (loosly) “capability testing based on version”. There are other similar techniques of capability testing, such as checking if a class responds to a particular selector, that work well in other situations.

    Generally, checking for the availability of a specific selector you want to use is better than checking version numbers. But in the case of something like a constant, checking the version of the underlying OS (in my opinion) is equally good.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According documentation: System.Array.Sort<T> - sorts the elements in an entire System.Array using the System.IComparable
According to select name from system_privilege_map System has been granted: SELECT ANY TABLE ...and
According to what I have found so far, I can use the following code:
According to the Doctrine manual I should be able to reference an attribute of
According to the MSDN article found at http://msdn.microsoft.com/en-us/library/wyk4d9cy.aspx the floating-point value .1 has no
According to wiki, VHD (Virtual Hard Disk) may contain what is found on a
According to http://www.bennadel.com/blog/1892-You-Cannot-Bind-The-Submit-Event-To-Objects-Using-jQuery.htm It is a bug: I am pretty sure this is a
According to the documentation i would like to overwrite predefined formats using this settings:
According to the HttpListener reference , a call to HttpListener.GetContext will block until it
According to the docs: http://msdn.microsoft.com/en-us/library/x13ttww7.aspx : The volatile keyword can be applied to reference

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.