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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:42:05+00:00 2026-06-07T02:42:05+00:00

I have a custom UITableViewCell prototype containing UITextField. I am adding new cells automatically

  • 0

I have a custom UITableViewCell prototype containing UITextField. I am adding new cells automatically when filling the UITextField in the last section. Where there are more sections that do not fit on one screen and I add another one, it gets filled with values from the first section and the first section inputs are emptied!

Screenshots:

first step

added fourth row - it contains a!

first row is empty!

Related code:

@implementation TMNewTripPeopleViewController

@synthesize sectionsCount = _sectionsCount;
@synthesize firstCellShowed = _firstCellShowed;

- (int) sectionsCount
{
    if (_sectionsCount == 0) {
        _sectionsCount = 1;
    }
    return _sectionsCount;
}

- (IBAction)inputChanged:(id)sender {
    UITextField* input = (UITextField*) sender;
    NSIndexPath* indexPathName = [NSIndexPath indexPathForRow:0 inSection:input.tag - 1];
    UITableViewCell* cellName = [self.tableView cellForRowAtIndexPath:indexPathName];

    if (input == [cellName viewWithTag:input.tag]) {
        // last name input - add next section?
        if (input.tag == self.sectionsCount) {
            if (input.text.length > 0) {
                self.sectionsCount++;
                [self.tableView insertSections:[NSIndexSet indexSetWithIndex:self.sectionsCount - 1] withRowAnimation:UITableViewRowAnimationTop];
            }
        }
    }

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.sectionsCount;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *CellIdentifier = @"PersonName";
    if (indexPath.row % 2 == 1) {
        CellIdentifier = @"PersonEmail";
    }
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    UITextField* input = (UITextField*) [cell viewWithTag:indexPath.section + 1];
    if (indexPath.row == 0 && indexPath.section == 0 && !self.firstCellShowed) {
        [input becomeFirstResponder];
        self.firstCellShowed = YES;
    }

    [cell viewWithTag:1].tag = indexPath.section + 1;

    return cell;
}

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

    I’m not seeing tableView:willDisplayCell:forRowAtIndexPath: in your implementation. You generally set your cell’s display values in this method.

    When you use dequeueReusableCellWithIdentifier (and you almost always should) then your cells will be reused when the table view is scrolled. If you don’t update their values in willDisplayCell then they will show whatever values they previously had before reuse (if any).

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

Sidebar

Related Questions

I have a custom UITableViewCell created in IB. All my cells will have this
I have a custom a UITableViewCell , it has two sections.(section contain one custom
I have a custom UITableViewCell with a UITextField and a method that is being
I have a custom UITableViewCell with two labels ( UILabel ). The table cells
I have a custom uitableviewcell. It has a uitextfield. I'd like the parent tableview
I have a custom UITableViewCell: @interface EditingTableViewCell : UITableViewCell <UITextFieldDelegate> { UITextField *editableText; UILabel
I have a UITableViewController with prototype cells containing UITextFields. To configure these custome cells,
I have custom UITableViewCell . It contains UITextLabel . When I press this cell
I have custom UITableViewCell s as well as headers and footers. Each of them
I have a custom UITableViewCell that seems to appear multiple times on my table

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.