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

  • Home
  • SEARCH
  • 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 6596401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:04:17+00:00 2026-05-25T18:04:17+00:00

I changed the backgroundColor of my UITableView (with a pattern image) and I want

  • 0

I changed the backgroundColor of my UITableView (with a pattern image) and I want my cells entirely white, I assigned a backgroundColor to cell.contentView. I cannot change the backgroundColor of accessoryType. How can I do that ?

Here is an illustration of what I have for the moment:

enter image description here

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIImage *bgImg = [UIImage imageNamed:@"backgroundPattern.png"];
    self.tableView.backgroundColor = [UIColor colorWithPatternImage:bgImg];
}

- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        // Put an arrow
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

        // In order to have my cell with a white background. I assign a whiteColor
        // to my contentView because assign color to the cell.backgroundColor property doesn't
        // to work..
        cell.contentView.backgroundColor = [UIColor whiteColor];

        // HERE is my problem, I would assign a backgroundColor of my accessoryType.
        // Because for the moment, just behind the accessoryType this is a the color of the
        // tableView.backgroundColor
        cell.accessoryView.backgroundColor = [UIColor whiteColor];
    }

    // Configure the cell...

    return cell;
}
  • 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-25T18:04:18+00:00Added an answer on May 25, 2026 at 6:04 pm

    Set the table view cell’s background color, not the content view’s.

    cell.backgroundColor = [UIColor whiteColor];
    

    The content view is only for the content your table view cell manages. Any additional views (like the accessor view or the reordering views when the table is in edit mode) are handled internally by the table view and table view cell class. They resize the content view as necessary, so you can’t rely on the content view to set the background color.

    EDIT: Sorry, this is incorrect. The correct place to set state-based properties on the table view cell is in the -tableView:willDisplayCell:forRowAtIndexPath: method of UITableViewDelegate. Set the cell’s background color here.

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

Sidebar

Related Questions

I want to change the background colour of a cell inside UITableView from default
I want to change the background color of the table cell when radio button
Is there any way to change the background color/image of the details UITableView in
Only the bottom cell of my UITableView is being edited when i change the
I changed the background color to black. - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor =
I'm trying to dynamically change a backgroundcolor in a part of a listview, I
I want to change the background color of a textbox as an indicator that
I want to change the background color of the child which is clicked in
I want to change the background color of our apps main window when a
I am trying to change the grey gradient background on an embedded UITableView to

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.