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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:57:37+00:00 2026-06-19T00:57:37+00:00

I have a UITextField, using this code, print the value on the label at

  • 0

I have a UITextField, using this code, print the value on the label at the bottom and formatting it.

NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];
[formatter setUsesGroupingSeparator:NO];
[formatter setMaximumFractionDigits:2];
[formatter setMinimumFractionDigits:2];
NSNumber *calcolo = [NSNumber numberWithDouble:[value1 doubleValue]-[self.textfield.text doubleValue]];
formattedString = [formatter stringFromNumber:calcolo];
self.label.text = formattedString;

On the simulator (U.S.), the value is displayed correctly. On the device (IT), there is the comma on keyboard, but the value after the comma is always zero.
enter image description here

EDIT: This works

NSNumber *temporaryValue1 = [formatter numberFromString:[NSString stringWithFormat:@"%@",value1]];
NSNumber *temporaryTextField = [formatter numberFromString:self.textField.text];
NSNumber *calcolo = [NSNumber numberWithFloat:([temporaryValue1 floatValue] - [temporaryTextField floatValue])];
formattedString = [formatter stringFromNumber:calcolo];
  • 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-06-19T00:57:38+00:00Added an answer on June 19, 2026 at 12:57 am

    I don’t think the issue is your output. The issue is the input you get from -[NSString doubleValue]. That method doesn’t honor the user’s locale.

    You should be able to use the formatter you made to convert self.textField.text to a number properly respecting the locale. Or you might consider using NSDecimalNumbers, especially if this is currency (looks like it?). Then NSDecimalNumber has a method +decimalNumberWithString which also does the right thing for you.

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

Sidebar

Related Questions

I am trying to set the focus of a uitextfield. Using this code [_partNoTextField
In my viewDidLoad I have the following Code: UIDatePicker* datePicker = [[UIDatePicker alloc] init];
I am using this code to implement a UITextField in my UIAlertView: UIAlertView *receivedAlert
I have a UITextField in My CustomCell of UITableview and i am using this
I use this code to resign my UITextField as firstResponder when using a standard
i have an UITextField which is allowing space using the following code snippet it
I have created a UITableView with two cells, username and password using the code
I'm using a UITextfield to input information. I have several UITextfields that need to
I have successfully implemented a UITextField in a UITableViewCell. Just like this: . I
I have to render dynamic form in iPhone application using tableview. This form may

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.