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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:27:52+00:00 2026-05-31T13:27:52+00:00

I want to add a textfield dynamically with tag so that it can give

  • 0

I want to add a textfield dynamically with tag so that it can give unique value every time. And than add those values and show on label. When I click button one textfield add “n” give the value, and that value adds to the previous value.

Value adding Successfully. But when I edit anything, change or give another value such as (10 instead of 12) the loop will run again because of this line

[Txt_New_Estimated addTarget:self action:@selector(C6Loop) forControlEvents:UIControlEventEditingDidEnd];

2nd problem is that when I add a new textfield then the previous textfield did not modify and do not add in rest of textfields… before adding a new textfield it works properly but when edit anything loop will run again…. i want to overCome this problem, so please check this code and give some possible solution. I am sending my code here Please check this code.

-(void)CreateTextFeildOnRun
{
if (tag ==0)
{
textPosY = 420;
}
for ( i =tag; i<= tag; i++) 
{
Txt_New_Estimated = [[UITextField alloc]initWithFrame:CGRectMake(360, textPosY , 130,         65)];
Txt_New_Estimated.delegate = self;
Txt_New_Estimated.text=@"";
//[Txt_New_Estimated setTag:1234];
Txt_New_Estimated.tag = i; 
Txt_New_Estimated.clearButtonMode = UITextFieldViewModeWhileEditing;
[Txt_New_Estimated addTarget:self action:@selector(C6Loop)    forControlEvents:UIControlEventEditingDidEnd];
Txt_New_Estimated.placeholder = @"Estimated";
Txt_New_Estimated.font = [UIFont fontWithName:@"Arial" size:23];
Txt_New_Estimated.backgroundColor = [UIColor whiteColor];
Txt_New_Estimated.textAlignment = UITextAlignmentCenter;
[scrollview addSubview:Txt_New_Estimated];

}
}

-(void)C6Loop{
Txt_New_ONU.text=Txt_New_Estimated.text;
[self Calculate2];

}

-(void)Calculate2{
int y14=([Txt_New_Estimated.text intValue]);
y14=n;
n=d;

c14=  y14+([Txt_New_Estimated.text floatValue]);

n  = c14;
[self addest];
}


-(void)addest{

float c1= ([Txt_Engring_Est.text floatValue]) + ([Txt_Weddring_Est.text floatValue]) +      ([Txt_Bridal_Est.text floatValue])+ ([Txt_Veil_Est.text floatValue])+ ([Txt_Shoe_Est.text   floatValue])+n;
Txt_Total_Est.text = [[NSString alloc] initWithFormat:@"%.2f",c1];
}  

Thank You.

  • 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-31T13:27:53+00:00Added an answer on May 31, 2026 at 1:27 pm

    Why don’t you add those TextField when created to to an NSMutableArray. something like this:

    -(void)createTextFieldOnRun
    {
        if (tag ==0)
        {
            textPosY = 420;
        }
        for ( i =tag; i<= tag; i++) 
        {
           UITextField *Txt_New_Estimated = [[UITextField alloc]initWithFrame:CGRectMake(360,textPosY ,130,65)];
           Txt_New_Estimated.delegate = self;
           //....other code..
           [scrollview addSubview:Txt_New_Estimated];
           [textFieldArray addObject:Txt_New_Estimated];
        }
    }
    

    and when calculating do something like this:

    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
    

    It doesn’t matter whether you change the value or not, it will recalculate all the values.

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

Sidebar

Related Questions

I want To add textfield dynamically with tag so that it can give unique
I want To add textfield dynamically with tag so that it can give unique
I want to add and fetch the value from dynamically created textfield with tag
I want to add time in my textfield and for that as per client's
I want to have a Form that can Add or Delete TextFields. I was
I have a list of string values that I want add to a hashtable
I want to add multiple text value in text field. The values comes from
Hey guys, I'm trying to add a textfield.text entry to an array. I want
i have an array of some values and i want to dynamically create textfields
I want to add a variable place holder in my textField and when something

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.