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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:01:06+00:00 2026-05-23T17:01:06+00:00

I want to use the default highlight on a UITableViewCell when it is tapped.

  • 0

I want to use the default highlight on a UITableViewCell when it is tapped. However, I do not want custom subviews (and their subviews) to receive the message to update their highlighted states and therefore disrupt the backgroundColor property.

Edit
By “subview” I mean any UIView subclass, not just UITableViewCells.

Perhaps this hypothetical situation will better articulate what I’m looking for: I have one UITableViewCell. Call it c. I then add one UIView (call it v) as a subview of c. When I tap c, I want c to become highlighted (standard blue background with white font color), but I do not want v to become highlighted. How do I make this happen?

  • 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-23T17:01:07+00:00Added an answer on May 23, 2026 at 5:01 pm

    First of all, UITableView enumarates all the subviews, and sends them highlight messages.

    So even if you put a UILabel in your view, no matter how deep it is, it traverses all views (by using subviews property).

    One solution can be (which is IOS4+), overriding subviews property, and cheat tableview’s highlight function that we do not have any subviews. To do that we need to determine the caller, and if it is tableview’s highlight method, we should return no subviews at all.

    We can create a simple UIView subclass and override subviews like below.

    - (NSArray *)subviews{
        NSString* backtrace = [NSString stringWithFormat: @"%@",[NSThread callStackSymbols]];
        if ([backtrace rangeOfString:@"_updateHighlightColorsForView"].location!=NSNotFound)
            return [super subviews];   
    
        return [[NSArray new] autorelease];
    }
    
    • callStackSymbols is available after IOS4+
    • _updateHighlightColorsForView is the UITableView’s method, responsible for highlighting all children
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use the default XML editor (org.eclipse.wst.xml.ui) of Eclipse in an RCP
I don't want to use the default route that vs.net creates: routes.MapRoute( Default, //
I want to use the Publish.GacRemove function to remove an assembly from GAC. However,
I DONOT WANT TO use the default error page tachnique, because i donot want
I want to use default SLF4J + Logback configuration except setting org.springframework.data.document.mongodb logging level
I want to use custom extension on my web site. I mean, I do
I want to use default keyboard for, but want also that it occurs with
I'm developing a ListView app for Android. I want to use the default ListView
I don't want to use the Default Satchmo search listener. I've created my own
I have a controller with some methods and I want to use the default

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.