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

  • Home
  • SEARCH
  • 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 7060835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:24:02+00:00 2026-05-28T04:24:02+00:00

I have a table view that has many cells. Each cell has its own

  • 0

I have a table view that has many cells. Each cell has its own UITextField. I added the text fields programmatically. I want each and every textField to appear when the edit button is hit. (now table is in edit mode) and when pressed again, i want all of the textFields to vanish(leaving the edit mode). I know that i can accomplish this using the hidden property, but i tried doing this in this method:

    - (IBAction)editButton:(id)sender 
{
    if (self.editing) 
    {
        [self setEditing:NO animated:YES];
        [self.myTableView setEditing:NO animated:YES];
        EditButton.title = @"Edit";
        cellText.hidden = YES;  //<-- THIS IS THE CODE
    } 
    else 
    {
        [self setEditing:YES animated:YES];
        [self.myTableView setEditing:YES animated:YES];
        EditButton.title = @"Done";
        cellText.hidden = NO;  //<-- THIS IS THE CODE
    }
}

but it only shows and hides the VERY LAST cell’s textField. How can i get it to where it shows and then doesnt show EVERY cell’s textFIeld? Many thanks in advance!!!

CELL FOR ROW

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
     {
         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];


         cellText = [[UITextField alloc]init];
         [cellText setFrame:CGRectMake(190, 15, 55, 30)];
         cellText.text = @"1";
         cellText.borderStyle = UITextBorderStyleRoundedRect;
         cellText.hidden = YES;
         cellText.userInteractionEnabled = NO;
         [cell addSubview:cellText];
    }    

return cell;
}

Thanks in advance!! 😀

  • 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-28T04:24:02+00:00Added an answer on May 28, 2026 at 4:24 am

    You can get rid of this issue, using this trick, I am not sure as if it would create the memory leak within your code.Since, it create new cell each time.But surely you can use it,if you don’t get some proper way of doing it. 😉

    - (IBAction)editButton:(id)sender 
    {
     if (self.editing) 
            {
                [self setEditing:NO animated:YES];
                [self.myTableView setEditing:NO animated:YES];
                EditButton.title = @"Edit";
    
            } 
            else 
            {
                [self setEditing:YES animated:YES];
                [self.myTableView setEditing:YES animated:YES];
                EditButton.title = @"Done";
    
            }
            [self.myTableView reloadData];
    }
    

    After reloading the TableView, check the condition in cellForRowAtIndexPath, either pass the value of self.editing to TextField which makes it hide/show.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"Cell";
    
        UITableViewCell *cell  = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    
    
        cellText = [[UITextField alloc]init];
        [cellText setFrame:CGRectMake(190, 15, 55, 30)];
        cellText.text = @"1";
        cellText.borderStyle = UITextBorderStyleRoundedRect;
        cellText.hidden = YES;
        cellText.backgroundColor = [UIColor redColor];
        cellText.userInteractionEnabled = NO;
        [cell addSubview:cellText];
    
        cellText.hidden=!self.editing;
    
        return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On each cell of my table view I want to have a bar that
I have view a that has a table cell and a save button. If
I have a table Scholars, that has many foreign keys to look-up tables such
I have a table view that I am customizing and I am adding a
I have a table view that is managed by an NSFetchedResultsController. I am having
I have an MVC application view that is generating quite a large HTML table
I have a self referencing table in Oracle 9i, and a view that gets
I have a Pages table that stores all my view urls and this table
I have a view that has a list of jobs in it, with data
i have a very simple table with only one row that has a uiswitch

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.