Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For the UIColor problem may I suggest adding a category to UIColor, like this:</p> <p><strong>UIColor+Extras.h</strong></p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface UIColor(Extras) + (UIColor *)colorWithRGBA:(NSUInteger) rgba; + (UIColor *)colorWithRGB:(NSUInteger) rgb; @end </code></pre> <p><strong>UIColor+Extras.m</strong></p> <pre><code>#import "UIColor+Extras.h" @implementation UIColor(Extras) + (UIColor *)colorWithRGBA:(NSUInteger) rgba { return [UIColor colorWithRed:(rgba &gt;&gt; 24) / 255.0f green:(0xff &amp; ( rgba &gt;&gt; 16)) / 255.0f blue:(0xff &amp; ( rgba &gt;&gt; 8)) / 255.0f alpha:(0xff &amp; rgba) / 255.0f]; } + (UIColor *)colorWithRGB:(NSUInteger) rgb { return [UIColor colorWithRed:(rgb &gt;&gt; 16) / 255.0f green:(0xff &amp; ( rgb &gt;&gt; 8)) / 255.0f blue:(0xff &amp; rgb) / 255.0f alpha:1.0]; } @end </code></pre> <p>This will let you write stuff like <code>[UIColor colorWithRGBA:0xFF00FFFF]</code> or <code>[UIColor colorWithRGB:0xFF00FF]</code></p> <p>As fo the starting color values, some of them are documented in the header files, like UIButton.h, and there are also some colors available as class methods on UIColor, like [UIColor lightTextColor] [UIColor darkTextColor] etc. These are documented in the UIColor class reference.</p> <p><a href="http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIColor_Class/Reference/Reference.html" rel="nofollow">http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIColor_Class/Reference/Reference.html</a></p> <p>If you want to retrieve the default color there is always:</p> <pre><code>[[button titleLabel] textColor] </code></pre> <p>To get the text color of any button. If you want the default color, create a hidden button and check the text color of it. Not very elegant mind you.</p>
 

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