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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:32:09+00:00 2026-05-28T05:32:09+00:00

when subclassing UITableViewCell to define a complete custom cell what style to set? UITableViewCellStyleDefault?

  • 0

when subclassing UITableViewCell to define a complete custom cell what style to set? UITableViewCellStyleDefault? Actually I don’t need neither the label or the imageView, would they be allocated the same?

So when attaching my custom views to the UITableViewCell subclass, is it better to add to self, or to self.contentView?

And is it ok to do some quartz drawing in drawRect in the UITableViewCell subclass (Like background) ?

Thanks

  • 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-28T05:32:09+00:00Added an answer on May 28, 2026 at 5:32 am

    when subclassing UITableViewCell to define a complete custom cell what style to set? UITableViewCellStyleDefault? Actually I don’t need neither the label or the imageView, would they be allocated the same?

    Since you are not using any of the pre-defined UILabel or UIImageView subviews of UITableViewCell, it doesn’t really matter. I just use UITableViewCellStyleDefault. I do not know for sure if the UILabels or the UIImageView are allocated or not. However, since there is no way to explicitly tell the UITableViewCell not to create those subviews, I wouldn’t worry about it. Even if they are created, you aren’t using them so drawing the cell will not be any slower, and since cells are reused as you scroll through the table, allocating just a few extra objects once is not going to affect your overall table view performance.

    So when attaching my custom views to the UITableViewCell subclass, is it better to add to self, or to self.contentView?

    All of the content should be put in the UITableViewCell contentView. This will ensure that the contents behave properly when the UITableView has an index on the right or if the UITableView (or UITableViewCell) go into editing mode.

    And is it ok to do some quartz drawing in drawRect in the UITableViewCell subclass (Like background) ?

    The recommended approach is for the background to be placed in the UITableViewCell backgroundView property. So I would not recommend doing any drawing in the UITableViewCell subclass itself. Just use the contentView, backgroundView, and selectedBackgroundView properties. You can create a simple UIView subclass and just set that as the backgroundView of the UITableViewCell, if you like.

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

Sidebar

Related Questions

I created a new custom TableViewCell by subclassing UITableViewCell. I created a table view
I made a custom cell for a UITableView (subclassing UITableViewCel, e..., and with a
I have a grouped UITableView with custom cells (created by subclassing UITableViewCell ). I
I setup a custom UITableViewCell and am subclassing it from UITableViewCell. I am using
I am using a UITableView to display custom content (by subclassing the UITableViewCell) and
I'm subclassing UITableViewCell and adding two subviews (image, UILabel). When the row is touched.
I'm subclassing QProgressBar in a custom widget, and I overwrote the paintEvent method with
I've found a strange issue with subclassing and dictionary updates in new-style classes: Python
I am always subclassing UITableViewCell's and drawing them in code. Is there a good
I am subclassing a UITableViewCell and in the drawRect: method I want to draw

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.