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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:39:57+00:00 2026-05-12T06:39:57+00:00

I’ve added a text shadow to cells in my UITableView to give them an

  • 0

I’ve added a text shadow to cells in my UITableView to give them an etched look:

cell.textLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1.000];
cell.textLabel.shadowColor = [UIColor whiteColor];
cell.textLabel.shadowOffset = CGSizeMake(0, 1);

Since the shadow color is actually white, when a row gets selected and becomes blue, the white shadow becomes really visible and makes the text look ugly.

Does anyone know how I can remove the shadow before the default cell selection style gets applied?

I have tried:

  1. Using -tableView:willSelectRowAtIndexPath: to unset the shadow with cell.textLabel.shadowColor = nil but this doesn’t work in time – the shadow gets unset only after the blue select style is applied.
  2. Checking cell.selected in tableView:cellForRowAtIndexPath: before setting the shadow but this obviously doesn’t work since the cell is not redrawn after a selection.

I also tried overriding the -tableView:willDisplayCell:forRowAtIndexPath: delegate method as Kevin suggested below. From logging statements I put in, this delegate method is only called just before a cell is drawn – by the time a cell is touched, it is already too late. This is the code I used

(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
  NSLog(@"in willDisplayCell");
  if (cell.highlighted || cell.selected) {
    NSLog(@"drawing highlighed or selected cell");
    cell.textLabel.shadowColor = nil;
  } else {
    cell.textLabel.shadowColor = [UIColor whiteColor];
  }
}
  • 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-12T06:39:58+00:00Added an answer on May 12, 2026 at 6:39 am

    One way which should work is to extend UITableViewCell and override the setSelected AND setHighlighted methods, setting the drop shadow state accordingly. This will make sure it’s painted at the same time as the background highlight update.

    - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
    {
        [super setHighlighted:highlighted animated:animated];
        [self applyLabelDropShadow:!highlighted];
    }
    
    - (void)setSelected:(BOOL)selected animated:(BOOL)animated
    {
        [super setSelected:selected animated:animated];
        [self applyLabelDropShadow:!selected];
    }
    
    - (void)applyLabelDropShadow:(BOOL)applyDropShadow
    {
        self.textLabel.shadowColor = applyDropShadow ? [UIColor whiteColor] : nil;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.