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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:56:17+00:00 2026-06-11T18:56:17+00:00

I am creating a custom UITableViewCell (programmatically, by subclassing) with one label and one

  • 0

I am creating a custom UITableViewCell (programmatically, by subclassing) with one label and one text field.

This code

#import "TextCell.h"

@implementation TextCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UITextField *subjectField = [[UITextField alloc] initWithFrame:CGRectMake(59, 11, 399, 21)];

        subjectField.font = [UIFont systemFontOfSize:17];
        subjectField.placeholder = @"(placeholder)";

        [self.contentView addSubview:subjectField];

        self.textField = subjectField;
    }
    return self;
}

results in invisible text field:

screenshot of the invisible field

But if I select this cell, the text field becomes visible:

enter image description here

If I implement

- (void)layoutSubviews
{
     self.textField.frame = CGRectMake(59, 11, 399, 21);

     /* thus text field init method becomes initWithFrame:CGRectZero;
}

the text field becomes visible, but the label goes away and the cell’s width suddenly increases:

enter image description here

Please, point me in the right direction.

  • 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-11T18:56:18+00:00Added an answer on June 11, 2026 at 6:56 pm

    With your first attempt, the text field will be behind the label, and so not visible. I assuming that’s the standard label from the cell that you are using? It doesn’t get created until you access it, and by default it is the full width of the cell, so it covers your text field. Use your own custom label with a specific frame to avoid this.

    In the second example, you’ve forgotten to call [super layoutSubviews] which is very important.

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

Sidebar

Related Questions

I'm creating custom table view cells, but result is incorrect. My code: - (UITableViewCell
I have the following code that just creates a custom UITableViewCell. I am creating
I am creating a custom UITableViewCell to include an UIImageView and some related text.
i am creating a Custom reusable UITableViewCell with Three labels and one imageView,and i
I have added some text to a UITableViewCell by creating the label with the
Background: I am creating a custom UITableViewCell and adding some views with text and
I'm creating custom UITableViewCells using the approach outlined on this page: http://icodeblog.com/2009/05/24/custom-uitableviewcell-using-interface-builder/ So my
Hopefully a quick one? I am creating a custom uitableviewcell and have added an
This part of my code for creating custom dialog.. final Dialog dialog = new
I am creating a custom Table by designing my own UITableViewCell in Xcode and

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.