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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:27:47+00:00 2026-05-27T13:27:47+00:00

I have looked on SO but cannot find an answer that works for me,

  • 0

I have looked on SO but cannot find an answer that works for me, so here goes:

I am trying to set color, font and size elements based on user preferences. I have no problem with font and font size, but I cannot seem to get the color to work.

This is what I’m doing:

  1. I have a group of constants, like:

    asterisk define kBlackColor @”[UIColor blackColor]”

  2. In reading my prefs file, I’ve determined that I want the blackColor, and set

    txtColor = kBlackColor;

txtColor is defined as:

NSString *txtColor;
  1. When I want to use txtColor, I’m writing this:

    cell.textLabel.textColor = (UIColor *) txtColor;

This compiles, but gives me an “unrecognized selector sent” message.

I would appreciate knowing the right way to go about this..

  • 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-27T13:27:48+00:00Added an answer on May 27, 2026 at 1:27 pm

    I decided to come at the problem a different way, so I should answer my own question – I hope it helps someone.

    Instead of allowing users to change each setting, I created a series of styles (0-5), stored (among other things) in a plist.

    Each style has a set of variables (font name, size, color, etc).

    The settings file uses variables as shown below and is read when the app is started:

    AppDelegate *mainDelegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
    styleKeyValue = [mainDelegate styleValueKey];   
    
    styleKey = [styleKeyValue intValue];
    
    switch (styleKey) {
    
            case 0:
                fontName = @"Arial"; 
                fontSize = 16;
                selectedTintColor = [UIColor blackColor];
                selectedFontColor = [UIColor blackColor];
                backgroundImage = @"background0.png";
                break;
    
    
            case 1:
                fontName = @"Times"; 
                fontSize = 14;
                selectedTintColor = [UIColor blueColor];
                selectedFontColor = [UIColor blackColor];
                backgroundImage = @"background1.png";
                break;
    
            case 5:
                ...
    
    
        }
    

    selectedTintColor and selectedFontColor are defined as:

    UIColor *selectedTintColor;
    UIColor *selectedFontColor;
    

    fontName and backgroundImage are defined as NSStrings. font size is a local integer.

    When I want to style a cell, I only have to enter this:

    cell.textLabel.font = [UIFont fontWithName:fontName size:fontSize];
    cell.textLabel.textColor = selectedFontColor;
    

    (The tintColor is used to style segmentedCells.)

    Again, I hope this helps someone. It took me all night to get to this rather simple solution..

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

Sidebar

Related Questions

I have looked but can't find anything that works. I have an old site
I have looked everywhere for the answer to this question, but cannot find anything
I have looked around but cannot find anything that answered this particular question related
I have looked and looked, but I cannot find a method that will allow
I've looked everywhere but cannot find an answer. How can I check that if
I've looked around the forum, but cannot seem to find a definite answer to
I have looked and looked but I cannot find a shortcut for File Search
I have looked but cannot find the API to convert from DATE to CTime
I have looked through the help documentation in netbeans 6.5.1 but cannot find anything
I have looked already and cannot find this but does anyone know of an

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.