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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:28:08+00:00 2026-06-10T17:28:08+00:00

Disclaimer: I’ve been working too late. But, I’m determined to get through this one

  • 0

Disclaimer: I’ve been working too late. But, I’m determined to get through this one tonight.

I have an app where I support different color themes. The dark cell backgrounds have been problematic.

I’ve been poking around trying to find a formidable way to draw the accessory disclosure icon in uitableviewcells with black backgrounds.

I decided to try overriding setAccessoryType to inherit the functionality for my 50+ views:

-(void) addWhiteDisclosureImage {
    UIImageView *disclosureView = (UIImageView*) [self.contentView viewWithTag:kDisclosureReplacementImageTag];

    if(!disclosureView) {
        [super setAccessoryType:UITableViewCellAccessoryNone];
        disclosureView = [[UIImageView alloc] initWithImage:self.whiteDisclosureImage];
        disclosureView.tag = kDisclosureReplacementImageTag;
        disclosureView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;

DebugLog(@"%f, %f", self.frame.size.width, self.frame.size.height);

        [self.contentView addSubview:disclosureView];
        [self.contentView bringSubviewToFront:disclosureView];
        [disclosureView release];
    }
}

- (void)setAccessoryType:(UITableViewCellAccessoryType)accessoryType {
    if(accessoryType == UITableViewCellAccessoryDisclosureIndicator) {
        if ([self.viewController isKindOfClass:[ViewControllerBase class]]) {
            ViewControllerBase *view = (ViewControllerBase*) self.viewController;
            if(view.colorTheme && view.colorTheme.controlBackgroundColor) {
                if([ViewColors colorAverage:view.colorTheme.controlBackgroundColor] < 0.2) { //substitute white disclosure indicator
                    [self addWhiteDisclosureImage];
                    return;
                } else { //not dark enough
                    [self removeWhiteDisclosureImage];
                    [super setAccessoryType:accessoryType];
                    return;
                }

            } else { //no colorTheme.backgroundColor
                [self removeWhiteDisclosureImage];
                [super setAccessoryType:accessoryType];
                return;
            }
        } else { //viewController is not type ViewControllerBase
            [self removeWhiteDisclosureImage];
            [super setAccessoryType:accessoryType];
            return;
        }

    }

    UIView *disclosureView = [self.contentView viewWithTag:kDisclosureReplacementImageTag];
    if(disclosureView)
        [disclosureView removeFromSuperview];
    [super setAccessoryType:accessoryType];
}

This override is typically called in cellForRowAtIndexPath.

It seemed like a good option until I drill down and come back. For some cells, the cell frame will be a great deal larger than the first time through. This consistently happens to the same cell in a list of 6 that I’ve been testing against. There’s clearly something unique about this cell: it’s frame.size.

Here is the size of the cell that I log for the first tableview load (in some cases every load/reload):
320.000000, 44.000000

This is the difference in what I get for some (not all) of the cells after call to reloadData:
759.000000, 44.000000

Does anyone know why this might happen?

Update: the suspect cell’s custom accessory disclosure view almost acts like it’s autoresizing flag is set to none. I confirmed this by setting all to none. I say almost because I see it line up where it should be after reloadData. A split second later it moves clear over to the left (where they all end up when I opt for no autoresizing).

  • 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-10T17:28:09+00:00Added an answer on June 10, 2026 at 5:28 pm

    Don’t mess around with subviews and calculating frames.
    Just replace the accessoryView with the new imageView. Let iOS do the work.

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

Sidebar

Related Questions

Disclaimer: I'm sure this has been answered before but I cannot find anything on
Disclaimer, new to programming, working my way through C++ Prime Plus 6th ed. I'm
Disclaimer : I already asked this question , but without the deployment requirement. I
Disclaimer: I am new to python and django but have Drupal programming experience. I'm
Disclaimer This is not strictly a programming question, but most programmers soon or later
( Disclaimer: This question is not specific to ASP.NET) I have a control which
Disclaimer I have searched for duplicates, but I can't seem to find them. I
Disclaimer: This is not actually a programming question, but I feel the audience on
Disclaimer: This is for a homework assignment, but the question is not regarding the
Disclaimer: this question may not have practical value, it's more of a puzzle/curiosity question.

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.