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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:48:47+00:00 2026-06-11T10:48:47+00:00

In my TableViewController I’m using custom cells. I’m displaying some data about the companies.

  • 0

In my TableViewController I’m using custom cells. I’m displaying some data about the companies. Company title is colored blue by default, and I’m checking if company does not have valid url so I can paint it black. Of course, I added a logic to forbid opening companies website if the company does not have valid Url.

However, every time this table view is displayed, there are several companies with valid urls who’s titles are painted black.

So, I’m using same logic for coloring the titles and opening urls in safari, but coloring does not work properly, and opening in safari does.

Any ideas what’s wrong here?

Here’s my cellForRowAtIndexPath function

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

    ResultsViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    // Configure the cell...
    Data *theData = [Data getInstance];
    Company *theCompany = [theData.results objectAtIndex:indexPath.row];

    cell.lblTitle.text = theCompany.DisplayName;

    cell.lblDescription.text = theCompany.Description;
    cell.lblAddressPt1.text = theCompany.AddressPt1;
    cell.lblAddressPt2.text = theCompany.AddressPt2;
    cell.lblPhone.text = theCompany.Phone;
    cell.lblEmail.text = theCompany.Email;

    cell.lblDescription.adjustsFontSizeToFitWidth = false;
    cell.lblDescription.lineBreakMode = UILineBreakModeWordWrap;
    cell.lblDescription.numberOfLines = 0;
    [cell.lblDescription sizeToFit];

    NSURL *candidateURL = [NSURL URLWithString:theCompany.Url];
    NSLog(@"%@", candidateURL);
    if (!(candidateURL && candidateURL.scheme && candidateURL.host)) {
        cell.lblTitle.textColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1];
    }

    return cell;
}

and this is the didSelectRowAtIndexPath

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    Company *company = [[Data getInstance].results objectAtIndex:indexPath.row];

    NSURL *candidateURL = [NSURL URLWithString:company.Url];
    if (candidateURL && candidateURL.scheme && candidateURL.host) {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:company.Url]];
    }
}
  • 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-11T10:48:49+00:00Added an answer on June 11, 2026 at 10:48 am

    You need to set cell.lblTitle.textColor explicitly always, as you might dequeue a cell with black label. So add an else clause and make sure you’re setting cell.lblTitle.textColor to some value always:

    if (!(candidateURL && candidateURL.scheme && candidateURL.host)) { 
       cell.lblTitle.textColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; 
    else
       cell.lblTitle.textColor = [UIColor colorWithRed:0 green:0 blue:1 alpha:1]; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some TableViewController with static Cells and some TextFields. A few Days ago,
I have a TableViewController on my storyboard that has some cells (static) that I
I have a TableViewController that is using a grouped Style and has two(2) sections.
I'm using a StoryBoard which contains various ViewControllers and a TableViewController, one in particular
I need to create a very long Static TableViewController. The static table has about
I have a view with a custom slider. We are using a subclass of
I have created an app that uses a tableViewController, and populates its cells from
I have a TableViewController with 5 cells added dymanically at run time. The initial
I have a TableViewController that's a NSFetchedResultsControllerDelegate . The data that this table is
When is cellForRowAtIndexPath called when the cells of a TableViewController are added dynamicall? Is

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.