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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:30:49+00:00 2026-06-13T01:30:49+00:00

Im new to xcode and objective c. I have asked this question three times

  • 0

Im new to xcode and objective c. I have asked this question three times and still can’t find a good method or answer. I have several uitextfields that accept user input and adds it to the combinedtextField in order of IBAction used.ie user inputs big in one field,bad in the next one and boy in the third and the result is big bad boy in the combinedtextField.

-(IBAction)addtextField1: (id)sender
{
 combinedtextField.text = [NSMutableString stringWithFormat:@"%@ %@",
 combinedtextField.text,textField1.text];
}

-(IBAction)addtextField2: (id)sender
{
 combinedtextField.text = [NSMutableString stringWithFormat:@"%@ %@",
             combinedtextField.text,  textField2.text];
}
-(IBAction)addtextField3:(id)sender
{
combinedtextField.text = [NSMutableString stringWithFormat:@"%@ %@",
                   combinedtextField.text,textField3.text];
}

Now this is where it gets interesting.I need to be able to remove the selected text from the combinedtextField.

-(IBAction)removetextField1:(id)sender
{
  //////////????????????////////////////
}

-(IBAction)removetextField2: (id)sender
{
  //////////????????????////////////////
}
-(IBAction)removetextField3: (id)sender
{
//////////????????????////////////////
}   

If I tap the removetextField2 button it would remove the corresponding text(bad) from the combinedtextField and then it would read (big boy)
Ive looked into nsarrays,nsdictionarys and other methods and have got no where.
Need some way of possibly tagging the input and removing it that way. Example code would be great and very much appreciated.

  • 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-13T01:30:50+00:00Added an answer on June 13, 2026 at 1:30 am

    You’ve left out some important details about your app, so I’m making some guesses about how it should work.

    Perhaps what you should do is keep a mutable array of all of the fragments that have been added to the combined string:

    @implementation MyViewController {
        NSMutableArray *fragments_;
    }
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        fragments_ = [[NSMutableArray alloc] init];
    }
    

    When one of the add buttons is tapped, you append the corresponding field’s text to the array and recompute the combined string:

    - (IBAction)addTextField1:(id)sender {
        [fragments_ addObject:textField1.text];
        [self updateCombinedTextField];
    }
    
    - (void)updateCombinedTextField {
        combinedTextField.text = [fragments componentsJoinedByString:@" "];
    }
    

    When one of the remove buttons is tapped, you try to remove the corresponding field’s text from the fragments array and recompute the combined string:

    - (IBAction)removeTextField1:(id)sender {
        [fragments_ removeObject:textField1.text];
        [self updateCombinedTextField];
    }
    

    That will remove all occurrences of field 1’s text from the fragments array. If you just want to remove one instance, you will need to use indexOfObject: (or one of its variants) followed by removeObjectAtIndex:.

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

Sidebar

Related Questions

I am very new to XCode and objective-c. This question may have been answered
Okay, I'm new to programming in XCode and Objective-C, and have a question. I
I'm still pretty new to Cocoa/Objective-C, so I hope I can explain my question.
I'm new to developing with xCode and Objective C, and I have a simple
I'm quite new to xcode na objective-c so I'm sorry for the dumb question.
First, I am super-new to Objective-C/iOS development and, in fact, this question is for
I am very new to xcode & Objective-C (having come from PHP) i have
So I'm pretty new to Xcode and Objective-C. I have several ArtPiece objects with
I'm new with XCode and still trying to understand objective-C. I'm using xcode 4.3.2,
I'm new at developing with XCode and Objective-C and I hope you can help

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.