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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:58:03+00:00 2026-05-19T00:58:03+00:00

I want to create a text field in the group table view cell. If

  • 0

I want to create a text field in the group table view cell. If I create one text field in a cell, the text fields are over lapped in all the grouped table view cells. I don’t know how it happened. So I want to create a text field in a grouped table view cell (Not all the cells). How can I achieve this? Is there any sample code available?

Here my sample code,

if(indexPath.section == 0)
{
    if(indexPath.row == 0)
    {
        UITextField * lastname = [[UITextField alloc] initWithFrame:CGRectMake(120, 5, 150, 35)];

        lastname.tag = titleTag2;

        [cell.contentView addSubview:lastname];

        lastname.delegate = self;

        lastname.returnKeyType = UIReturnKeyDefault;
    }
}
  • 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-19T00:58:04+00:00Added an answer on May 19, 2026 at 12:58 am

    just in case anyone comes across this question, this is how you add UITextFields to a group table.

    In the UITableViewController (which I assume is the table’s delegate & datasource) implement the following functions:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
        static NSString *CellIdentifier = @"CellIdentifier";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    
            if (indexPath.section == 0) {
    
                // Add a UITextField
                UITextField *textField = [[UITextField alloc] init];
                // Set a unique tag on each text field
                textField.tag = titleTag2 + indexPath.row;
                // Add general UITextAttributes if necessary
                textField.enablesReturnKeyAutomatically = YES;
                textField.autocorrectionType = UITextAutocorrectionTypeNo;
                textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
                [cell.contentView addSubview:textField];
                [textField release];
            }
        }
    
        // Configure the cell...
        [self configureCell:cell atIndexPath:indexPath];
    
        return cell;
    }
    
    
    - (void)configureCell:(UITableViewCell *)theCell atIndexPath:(NSIndexPath *)indexPath {
    
        if (indexPath.section == 0) {
    
            // Get the text field using the tag
            UITextField *textField = (UITextField *)[theCell.contentView viewWithTag:titleTag2+indexPath.row];
            // Position the text field within the cell bounds
            CGRect cellBounds = theCell.bounds;
            CGFloat textFieldBorder = 10.f;
            // Don't align the field exactly in the vertical middle, as the text
            // is not actually in the middle of the field.
            CGRect aRect = CGRectMake(textFieldBorder, 9.f, CGRectGetWidth(cellBounds)-(2*textFieldBorder), 31.f );
    
            textField.frame = aRect;
    
            // Configure UITextAttributes for each field
            if(indexPath.row == 0) {
                textField.placeholder = @"Name";
                textField.returnKeyType = UIReturnKeyNext;
                textField.autocapitalizationType = UITextAutocapitalizationTypeWords;
            } else if(indexPath.row == 1) {
                textField.placeholder = @"Email Address";
                textField.returnKeyType = UIReturnKeyNext;
                textField.keyboardType = UIKeyboardTypeEmailAddress;
            } else {
                textField.placeholder = @"Password";
                textField.returnKeyType = UIReturnKeyDone;
                textField.secureTextEntry = YES;
            }
        }           
    }
    

    Obviously, you’ll still need to implement the UITextFieldDelegate methods to actually process the text entry and moving the first responder between fields.

    UPDATE: Since posting this, I realised that you can use the UIControl contentVerticalAlignment property, and set that to UIControlContentVerticalAlignmentCenter, in which case you can just set your frame to the bounds of the cell’s content view.

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

Sidebar

Related Questions

can some one help me creating a vertical text field. actually I want to
I want to create some text in a canvas: myText = self.canvas.create_text(5, 5, anchor=NW,
I've created a custom UITableViewCell with a label and a text field. I want
I am trying to query a string (TEXT field in the database) and want
I have a text field that I want to save periodically as users type
I followed the tutorial Create a model through text field (Railscast #57) which works
I want create a drop shadow around the canvas component in flex. Technically speaking
I want to create a Java application bundle for Mac without using Mac. According
I want to create a client side mail creator web page. I know the
I want to create a function that performs a function passed by parameter on

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.