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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:11:16+00:00 2026-06-06T02:11:16+00:00

I have added a TextField to a UICell in order to allow a user

  • 0

I have added a TextField to a UICell in order to allow a user to change the TextLabel of said cell. Everything works fine in that the keyboard appears and the TextLabel changes to the correct value when I press return. I can’t, however, SEE the text as it is being edited. Here is my code:

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {


     [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
     UITableViewCell *aCell = [self.tableView cellForRowAtIndexPath:indexPath];
     NSString *aCategory = aCell.textLabel.text;
     [[aCell detailTextLabel] setText:aCategory];


     [aCell setEditing:YES animated:YES];
     UITextField *userText =[[UITextField alloc] init];
     userText.tag = indexPath.row;
     [aCell addSubview:userText];
     NSArray *test =[aCell subviews];
     NSLog(@"I have %d many subviews",[test count]);
     userText.alpha=1.0;
     [userText setDelegate:self];
     userText.autocorrectionType = UITextAutocorrectionTypeNo;
     [aCell bringSubviewToFront:userText];
     [userText becomeFirstResponder];


 }

I would like to do it without custom cells if possible. 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-06-06T02:11:17+00:00Added an answer on June 6, 2026 at 2:11 am
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
        UITableViewCell *aCell = [self.tableView cellForRowAtIndexPath:indexPath];
        NSString *aCategory = aCell.textLabel.text;
        [[aCell detailTextLabel] setText:aCategory];
    
        UITextField *userText = [[UITextField alloc] initWithFrame:aCell.textLabel.frame];
        userText.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        userText.font = aCell.textLabel.font;
        userText.text = aCell.textLabel.text;
        aCell.textLabel.text = nil;
        userText.tag = indexPath.row;
        [aCell addSubview:userText];
    
        [userText setDelegate:self];
        userText.autocorrectionType = UITextAutocorrectionTypeNo;
        [aCell bringSubviewToFront:userText];
        [userText becomeFirstResponder];
    }
    
    - (void)textFieldDidEndEditing:(UITextField *)textField
    {
        NSIndexPath *indexPath = [NSIndexPath indexPathForRow:textField.tag inSection:0];
        UITableViewCell *aCell = [self.tableView cellForRowAtIndexPath:indexPath];
        aCell.textLabel.text = textField.text;
        [textField removeFromSuperview];
    }
    
    - (BOOL)textFieldShouldReturn:(UITextField *)textField
    {
        [textField resignFirstResponder];
        return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a textfield that i want to hide when the user presses the
I have a cell editor that contains a little button and then a textfield
I have added a checker to ensure that all fields in a form have
I am using eclipse and I have two TextField such that one text field
I have two text fields. In the first textfield I have added a calendar
I have a Jwindow, and when I added a Jtextfield to it, the textfield
I have qtyTextFields that are added to a custom UITableViewCell dynamically. What I am
I have added the following code for displaying a scrollbar to my textfield. But
I have a UITextField added to an UIAlerView (Kind of adding user to list
I have a class that looks like this: public class TextField : TextBox {

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.