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

  • Home
  • SEARCH
  • 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 6200083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:18:11+00:00 2026-05-24T04:18:11+00:00

Possible Duplicate: Iphone UITextField only integer I want to place a text field that

  • 0

Possible Duplicate:
Iphone UITextField only integer

I want to place a text field that only accepts numbers (0-9, doesn’t even need decimals), but even using the “Number Pad” entry option I still get a keyboard with various symbols on it. Is there a better control for this, is there a better control for what I’m doing, or do I just have to validate input manually?

  • 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-24T04:18:14+00:00Added an answer on May 24, 2026 at 4:18 am

    The following code will allow you to only input numbers as well as limit the amount of characters that can be used.

    -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
    {
        /*  limit to only numeric characters  */
        NSCharacterSet *myCharSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
        for (int i = 0; i < [string length]; i++) {
            unichar c = [string characterAtIndex:i];
            if ([myCharSet characterIsMember:c]) {
                return YES;
            }
        }
    
        /*  limit the users input to only 9 characters  */
        NSUInteger newLength = [customTextField.text length] + [string length] - range.length;
        return (newLength > 9) ? NO : YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: iPhone development on Windows Hello friends, I Want To Know that Is
Possible Duplicate: How to programmatically send SMS on the iPhone? I want to implement
Possible Duplicate: iPhone inputting NSUserDefaults into a UITextField Is there a way to remember
Possible Duplicate: UITextField in UIAlertView on iPhone - how to make it responsive? UITextField
Possible Duplicate: Open source iPhone Coverflow like library hello all i want to develop
Possible Duplicate: Uploading and downloading via ftp with iPhone SDK I want to implement
Possible Duplicate: Text to speech on iPhone I have a string say Hello world.
Possible Duplicate: When to use PNG or JPG in iPhone development? I want to
Possible Duplicate: Save Youtube video to iPhone in the app I want to download
Possible Duplicate: iPhone Mobile Safari File System Access I want to open a locally

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.