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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:03:28+00:00 2026-05-31T12:03:28+00:00

I have a plain table view that is laying out properly except that the

  • 0

I have a plain table view that is laying out properly except that the textLabel on one of the rows is appearing as a black bar, i.e. like black text on a black background. If I select that row, the text shows up fine. But if I select another row, it disappears again.

I discovered that the row being blacked out was the one that I programatically selected during the - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath method.

My code looked something like this:

cell.selectionStyle = UITableViewCellSelectionStyleBlue;

cell.textLabel.font = [UIFont systemFontOfSize:14];
cell.textLabel.text = @"some text";

if (self.selectedRow == indexPath.row) cell.selected = YES;

I solved the problem by selecting the cell before setting the selectionStyle, i.e. moving the last line to the top.

I’m sure there must be a rational explanation but thought I’d contribute just in case someone else encounters something similar.

  • 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-31T12:03:29+00:00Added an answer on May 31, 2026 at 12:03 pm

    First, don’t play with the selection at cellForRowAtIndexPath if you don’t want to get a surprise like this one, the “selected” property of a cell might be changed manually (nothing at developers reference forbid to do that), and you’ll to do it after [tableView reloadData] call if the cell needs to be selected just after the view appeared.

    Second, placing the last line from the snippet leaves the cell not displayed as selected while isSelected will be YES – not good at all.

    Third and the last, “.text =” after “.selected =” is what removes the black-on-black artifact, it has nothing to do with the selection style i believe. However, the cell will not be displayed as selected – and that is really bad.

    Let me know if you need more details of how you can correctly select the cell programmatically.

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

Sidebar

Related Questions

I have about 40000 records in that table that contains plain text and within
In OS3.0 a lot of plain table views have an initially hidden search bar
I have several databases that each have a table called, say, products . One
I currently have a very wide data view as a plain html table and
I have a simple three table reference. It looks plain enough. The associations there
In an app I'm working on, I have a plain style UITableView that can
I have an optimization problem for the headers of a table with plain style.
On an iPhone, how do you figure out the width of a table view
I have a view containing a UITableView. Above the table I'd like to display
I have a plain text file that I need to read in using C#,

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.