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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:44:20+00:00 2026-06-05T04:44:20+00:00

I have a table view consisting of lots of fields, divided into sections, with

  • 0

I have a table view consisting of lots of fields, divided into sections, with the fields sourced from a database. I wish to support in-place editing of the text in the fields, so I create a text field for each row and add it to me cell:

[cell.contentView addSubview:myTextField];

I give the text field a fixed tag so that I can easily configure the cell:

- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
    Item *item = [self itemWithIndexPath:indexPath];
    UITextField *textField = (UITextField *)[cell.contentView viewWithTag:1000];
    textField.text = item.name;
}

When the text field has been edited I need to update the database. I can set up a delegate on the text field to respond to the end of the editing, but I somehow have to find out which indexPath has been edited so that I can update the database appropriately.

How can I do this?

I suppose I could maintain a tag->IndexPath mapping that get’s updated each time I configure a cell, but that feels like overkill. Is my tired brain missing the obvious?

Thanks,

Tim

  • 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-05T04:44:22+00:00Added an answer on June 5, 2026 at 4:44 am

    So, my brain started working:

    - (void)textFieldDidEndEditing:(UITextField *)textField
    {
        UITableViewCell *cell = (UITableViewCell *)textField.superview.superview;
        NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
        Item *item = [self itemWithIndexPath:indexPath];
        item.name = textField.text;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table View with grouped style with three sections. Get information from dictionary
I have table view which is populated from an array grabbed from a url.
I have a table view and it is load from table view cells. But
I have table view to load data from an API call. I am using:
I have table view navigation controller and the data is loaded from url. I
I have a table view(HomeViewController) consisting of items as: locations Reporting Setting I am
I have a table view that loads information from the web, and displays it
I have created a simple view consisting of 3 tables in SQL. By right
I have a table view of peoples names and when I click on one
I have a table view with numerous cells. When I press one, a tick

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.