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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:22:43+00:00 2026-05-29T13:22:43+00:00

Possible Duplicate: How to do edit-in-place in a UITableView? I am new to this

  • 0

Possible Duplicate:
How to do edit-in-place in a UITableView?

I am new to this iphone developing.
I just want to know how to edit/update UITextLabel in a tableView.

I am already using edit/done animation and able to delete rows but i am not able to get how to edit the text in those rows.

I want the user to edit the textlabel of the cell.when edit button is tapped.

i already searched the site but couldnt get the exact answer.

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CellIdentifier"];
if(!cell)
{
    cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellIdentifier"]autorelease];
    cell.editingAccessoryType=YES;
}


myTextField = [[UITextField alloc] initWithFrame:CGRectMake(15, 6, 241, 31)];
myTextField.backgroundColor = [UIColor clearColor];
myTextField.textAlignment = UITextAlignmentLeft;
myTextField.returnKeyType = UIReturnKeyDone;
myTextField.delegate = self;
cell.accessoryView = myTextField;
myTextField.text = [self.arrayOfItems objectAtIndex:indexPath.row];
myTextField.enabled = NO;
return cell;
}

-(IBAction)Edit:(id)sender
{
if(self.editing)
{
            [myTextField.Enabled = YES];
    [super setEditing:NO animated:NO];
    [self.tab setEditing:NO animated:NO];
    [self.tab reloadData];
    [self.navigationItem.rightBarButtonItem setTitle:@"Done"];
    [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStylePlain];
}
else 
{
    myTextField.enabled= YES;

    [super setEditing:YES animated:YES];
    [self.tab setEditing:YES animated:YES];
    [self.tab reloadData];
    [self.navigationItem.rightBarButtonItem setTitle:@"Edit"];
    [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone];
 }
 }

- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 
{
if (self.editing == NO || !indexPath) 
return UITableViewCellEditingStyleNone;
if (self.editing && indexPath.row == ([self.arrayOfItems count])) 
{
    return UITableViewCellEditingStyleInsert;
} 
else 
{
    return UITableViewCellEditingStyleDelete;
}
return UITableViewCellEditingStyleNone;
}

This is not working for me.textfield is disappearing if i hit edit button

  • 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-29T13:22:43+00:00Added an answer on May 29, 2026 at 1:22 pm

    Editing text in the table rows themselves is difficult because you need to manage the keyboard and scrolling the editable field up to make room for the keyboard etc. (that could be scrolled off screen while being edited etc.). Also if you make every cell editable you have to managed an edited value being able to be scrolled off screen mid-edit etc. (i.e. while the keyboard is active and so forth).

    A UILabel is not editable, you need a UITextField to edit text.

    The best way to achieve an edit of a value in a table cell is probably to push a new view controller onto the stack on the edit action and have an editable text field there and add save/cancel bar button items to the menu of that view controller.

    When the user presses save, update the model behind the table view with the appropriate text value and pop the view controller off the stack again. Have the main view containing the table call reloadData on the tableView in its viewWillAppear method.

    This will give you easiest/best control of the keyboard behaviour and editing behaviour when the fields are being edited.

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

Sidebar

Related Questions

Possible Duplicate: Plugging in to Java compilers Edit - this appears to be a
Possible Duplicate: “Least Astonishment” in Python: The Mutable Default Argument Edit: This has nothing
Possible Duplicate: Uploading and downloading via ftp with iPhone SDK I want to implement
Possible Duplicate: php edit for Cufon font replacement I am reposting this due to
Possible Duplicate: C# 'var' keyword versus explicitly defined variables EDIT: For those who are
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: String vs string in C# I know there is no difference between
Possible Duplicate: where to place an xml file with data in app I'm kinda
Possible Duplicate: Override django-admin edit form field values for encrypted data The inline model
Possible Duplicate: Dynamically adding collapsible elements I would like to know how I could

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.