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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:28:25+00:00 2026-05-13T18:28:25+00:00

I have two text fields in which numbers are inputed as strings. I need

  • 0

I have two text fields in which numbers are inputed as strings. I need to convert the strings to numbers, add them together and then display the result in a 3rd textfield.

I am totally new to iPhone programming .. So please don’t be hard on me 😛

Ok here is the problem

AdditionViewController.h

#import <UIKit/UIKit.h>

@interface AdditionViewController : UIViewController 
{
    IBOutlet UITextField *Number1;
    IBOutlet UITextField *Number2;
    IBOutlet UITextField *SumAnswer;
}

@property (retain, nonatomic) UITextField *Number1;
@property (retain, nonatomic) UITextField *Number2;
@property (retain, nonatomic) UITextField *SumAnswer;
-(IBAction)buttonPressed1:(id)sender;

@end

AdditionViewController.m

#import "AdditionViewController.h"

    @implementation AdditionViewController
    @synthesize Number1;
    @synthesize Number2;
    @synthesize SumAnswer;


    -(IBAction)buttonPressed1:(id)sender
    {
        SumAnswer.text = Number1.text + Number2.text; 
           // I want the above line to be edited so that I can get the addition
             of both the numbers in the 3rd Text Field 
    }

    -
    -
    -
    -
    -
    @end

I am really new to iPhone programming .. I am trying to understand how NSString can be used here .. But I am finding it a bit complicated .

If someone please tell me what the code should be … It will be a great help . I have to submit a mini project to my school asap .

Thanking You , int3rc3pt0r

  • 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-13T18:28:26+00:00Added an answer on May 13, 2026 at 6:28 pm

    NSString has method allowing to get numeric value from it (e.g. intValue, floatValue etc) – you can use them to convert string to numbers. To convert numbers to string you can use stringWithFormat: method – the way it takes format specifiers is similar to printf function in c.

    -(IBAction)buttonPressed1:(id)sender
    {
        // You may also need to check if your string data is a valid number
        int result = [Number1.text intValue] + [Number2.text intValue];
        SumAnswer.text = [NSString stringWithFormat:@"%d", result];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 418k
  • Answers 419k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Core Data is magic. More seriously, these methods are generated… May 15, 2026 at 10:10 am
  • Editorial Team
    Editorial Team added an answer In your handler for Mojo.Event.tap, look at the event's count… May 15, 2026 at 10:10 am
  • Editorial Team
    Editorial Team added an answer You're confusing two features here. Intellisense is the feature that… May 15, 2026 at 10:10 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.