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 1052419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:05:27+00:00 2026-05-16T17:05:27+00:00

I need my user to input some data like DF-DJSL so I put this

  • 0

I need my user to input some data like DF-DJSL so I put this in the code:

theTextField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;

But unfortunately what happens is the first to letter type in CAPS but then letter immediately after typing the hyphen will be in lower case and then the rest return to CAPS therefore producing output like this (unless the user manually taps the shift button after typing a hyphen): DF-dJSL

How can I fix this?

Many Thanks

  • 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-16T17:05:27+00:00Added an answer on May 16, 2026 at 5:05 pm

    You don’t mention which SDK you’re using, but against 3.0 and above I see your desired behaviour.

    That said, you could always change the text to upper case when they finish editing using the textFieldDidEndEditing method from the delegate:

    - (void)textFieldDidEndEditing:(UITextField *)textField {
        NSString *textToUpper = [textField.text uppercaseString];   
        [theTextField setText:textToUpper];
    }
    

    Or, by setting up a notification on the textfield when it changes, you could change the text as it is being typed:

    // setup the UITextField
    {
        theTextField.delegate = self;
        theTextField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
        [theTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
    }
    

    You have to do it this way since, unlike UISearchBar, UITextField doesn’t implement textDidChange. Something like this, perhaps?

    - (void)textFieldDidChange:(UITextField *)textField {
        NSRange range = [textField.text rangeOfString : @"-"];
        if (range.location != NSNotFound) {
            theTextField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a modal dialog to gather some user input. I then need the
I need to validate the user input of a JSpinner , and if invalid,
Many of us need to deal with user input, search queries, and situations where
I need a user to be able to enter a URL, and would like
I need to store user entered changes to a particular table, but not show
I want to do some calculations with polygons. So I need the user to
We need a user control that can show Microsoft Office files (Word, Excel..). There
I have an application where I need the user to upload a photo. After
I have a series of forms that I need a user to complete in
I need the current user and the domain. I am using a VB 6

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.