Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I might seems as if the themer returns a Number instead of a color, maybe the themer deals in RGB hex values?</p> <p>I sometimes build a customColor class with a Class Method + (UIColor*)getCustomColor:(CustomColorType) color; that I use once the color theme of the app is determined, it also gives you the benefit of being able to change colors one place and have the change be instant everywhere. I usually do this in 0xFFFFFFFF values as that is how most designers deal with the color.</p> <p>This is "Copy-wasted" from my last project:</p> <pre><code>// // CustomColor.h // FC // // Created by RickiG on 12/19/09. // Copyright 2009 www.rickigregersen.com.. All rights reserved. // #import &lt;Foundation/Foundation.h&gt; typedef enum { CustomColorWhiteText, CustomColorDarkGreyText, CustomColorLightGreyText, CustomColorGreyText, CustomColorLightBlueText, CustomColorDarkWhiteText, CustomColorLightWhiteText, CustomColorLightPurpleText, CustomColorOrange, CustomColorRed, CustomColorSilver, } CustomColorType; @interface CustomColor : NSObject { } + (UIColor*) getCustomColor:(CustomColorType) color; @end </code></pre> <p>And the implementation:</p> <pre><code>// // CustomColor.m // FC // // Created by RickiG on 12/19/09. // Copyright 2009 www.rickigregersen.com.. All rights reserved. // #import "CustomColor.h" @implementation CustomColor + (UIColor*) getCustomColor:(CustomColorType) color { int value; switch (color) { case CustomColorWhiteText: value = 0xffffff; break; case CustomColorDarkGreyText: value = 0x373737; break; case CustomColorGreyText: value = 0x7a7a7a; break; case CustomColorLightGreyText: value = 0xd3d3d3; break; case CustomColorLightBlueText: value = 0x8ed6ff; break; case CustomColorDarkWhiteText: value = 0x979797; break; case CustomColorLightWhiteText: value = 0xe8e8e8; break; case CustomColorLightPurpleText: value = 0xd17efc; break; case CustomColorOrange: value = 0xfb8720; break; case CustomColorRed: value = 0xeb0008; break; case CustomColorSilver: value = 0xe3e3e3; break; default: value = 0x000000; break; } int r, g, b; b = value &amp; 0x0000FF; g = ((value &amp; 0x00FF00) &gt;&gt; 8); r = ((value &amp; 0xFF0000) &gt;&gt; 16); return [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1.0f]; } @end </code></pre> <p>This way I can always go:</p> <pre><code>[UIView setBackgroundColor:[CustomColor getCustomColor:CustomColorWhiteText]; </code></pre> <p>From anywhere in my project. I have the same type of file to deal with textlabels, buttons and other interface elements that are reused through an app.</p> <p>Hope it helps if you are building a UI that should be able to change it's appearance on the fly, even though it was not exactly what you asked:)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload