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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:42:23+00:00 2026-06-17T02:42:23+00:00

I Have a textfield and I need the user to put a number in

  • 0

I Have a textfield and I need the user to put a number in there, this number I need to transform into a float value and take it to another view. I can’t find my error… Xcode says it is on the “float valor = [[_inserir.text ] floatvalue];“line. If somebody could find where is my error, thanks.

first view .h:

#import <UIKit/UIKit.h>

@interface CedulasFirstViewController : UIViewController
@property (strong, nonatomic) IBOutlet UITextField *inserir;
- (IBAction)calc:(id)sender;

@end

first view .m: (the underline before my variable name, xcode put it by itself, taking it out doesn’t change anything)

#import "CedulasFirstViewController.h"
#import "CedulasSecondViewController.h"

@interface CedulasFirstViewController ()

@end

@implementation CedulasFirstViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)calc:(id)sender {

    float valor = [[_inserir.text ] floatvalue];

    CedulasSecondViewController *second [[[CedulasSecondViewController alloc] init]];

    second.valor = self.valor;

}
@end

second view .h:

#import <UIKit/UIKit.h>

@interface CedulasSecondViewController : UIViewController{


}

@end

second view .m:

#import "CedulasSecondViewController.h"

@interface CedulasSecondViewController ()

@end

@implementation CedulasSecondViewController

- (void)viewDidLoad
{

    NSString *numberFromTF [[NSString alloc] initWithFormat:@"%.2f", valor];

    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

Thanks

EDIT:

if someone could explain me why xcode says to put this underline before the variable

  • 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-17T02:42:25+00:00Added an answer on June 17, 2026 at 2:42 am

    There are a few things you need to do here.

    First, you’ve created a property in CedulasFirstViewController.h, so you need to synthesize it in CedulasFirstViewController.m. In CedulasFirstViewController.m, beneath the line @implementation CedulasFirstViewController, type

    @synthesize inserir;
    

    Then, in the line float valor = [[_inserir.text ] floatvalue];, there are a couple errors. You’re treating your property like an instance variable, so instead of _inserir.text you should use self.inserir.text. Also, you should remove the inner pair of brackets, because brackets are used for when functions are being performed, and there’s no function being performed in self.inserir.text. self.inserir.text (or _inserir.text, for that matter) is simply an object.

    All this means that the line producing the error should look like this:

    float valor = [self.inserir.text floatvalue];
    

    There seem to be some other problems with this code, but if you ask about them those should be a separate question.

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

Sidebar

Related Questions

I have a textfield where the user can type what ever he want into
I have a textField and textView that I need user entered URLs to be
I have a textfield, in which I need the user to type only numeric
Need help figuring this out. I have two tables user ---- name skills (comma
I have a review PAGE with a TEXTFIELD. User need to be able to
i need to have a textfield that does not show anything if the user
i have a text field in Contact screen and the user need to enter
I have a starttime as textfield. I need to covert the String which I
In my view i have Textfield.If i move that TextField it should open iphone
I need to get text from a textfield when user presses any key. I

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.