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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:34:37+00:00 2026-05-31T11:34:37+00:00

How to calculate and pick the value from two diffrent array on a same

  • 0

How to calculate and pick the value from two diffrent array on a same loop?

something like that

eg:

for(UITextField *field in textFieldArray && textFieldArray2)

i have to subtract the value and i have 2 Array and i want to subtract the value of two textfield from different array but same index…

My code is

int result = 0;
for(UITextField *field in textFieldArray) // will iterate all UITextField which was added
{
    result += [field.text intValue]; //or floatValue
}
NSLog(@"the result is %d", result); //here you have sum of all the text fields' text

i want to subtract this but both text fields are on different Array but have same index…

int y12 = ([Txt_New_Actual.text intValue]);
float c116 = y12-([Txt_New_Estimated.text floatValue]);
Txt_New_ONU.text = [[NSString alloc] initWithFormat:@"%.2f",c116];
  • 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-31T11:34:39+00:00Added an answer on May 31, 2026 at 11:34 am

    Get the index of the current object in your fast enumeration loop, then use indexOfObject: to get the index and use that with objectAtIndex: on your second array.

    Something like this:

    int result = 0;
    for(UITextField *field in textFieldArray)
    {
        int indexOfObject = [textFieldArray indexOfObject:field];
        UITextField *secondValue = (UITextField *)[textFieldArray objectAtIndex:indexOfObject];
        result += [secondValue.text intValue];
    }
    NSLog(@"the result is %d", result); 
    

    You should still put some kind of check into that code if the returned value from the 2nd array is valid.

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

Sidebar

Related Questions

I'd like to calculate the time my script runs, but my result from get-date
How can I calculate the value of PI using C#? I was thinking it
How do I calculate the distance between two points specified by latitude and longitude?
I need to calculate Math.exp() from java very frequently, is it possible to get
Instead of rating items with grades from 1 to 10, I would like to
I would like to calculate the width of child-container (div etc) in percentages depending
I need to calculate Gps Location on the move and on deviation from certain
I am working on a very simple app that will let user to pick
There are a couple of times I've wanted to use the value from a
In calculate if two arbitrary regular expressions have any overlapping solutions (assuming it's possible).

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.