Difference between revisions of "UIColor"

From iPhone Development Wiki
Jump to: navigation, search
(Created page with '{{occlass|library=UIKit.framework}} UIColor is a class representing a solid color or a pattern, similar to brushes in Windows GDI. == Predefined colors == UIColor defines a…')
 
m (CSS colors)
Line 102: Line 102:
  
 
== CSS colors ==
 
== CSS colors ==
<source lang="objc">-(NSString*)styleString;</source>
+
{{Function_signature
 +
|signature=-(NSString*)styleString
 +
|firmware=2.0 – 3.1
 +
}}
 +
 
 
UIColors can be converted to CSS colors by the <tt>-styleString</tt> method. For example, <tt>[[UIColor lightTextColor] styleString]</tt> gives <tt>@"rgba(255,255,255,153)"</tt>.
 
UIColors can be converted to CSS colors by the <tt>-styleString</tt> method. For example, <tt>[[UIColor lightTextColor] styleString]</tt> gives <tt>@"rgba(255,255,255,153)"</tt>.
  

Revision as of 18:03, 11 October 2009


UIColor is a class representing a solid color or a pattern, similar to brushes in Windows GDI.

Predefined colors

UIColor defines a list of commonly accessed colors. They can be received using +[UIColor someColor], as listed below:

Documented solid colors

blackColor
0.000
darkGrayColor
0.333
lightGrayColor
0.667
whiteColor
1.000
grayColor
0.500
redColor
1.00, 0.00, 0.00
greenColor
0.00, 1.00, 0.00
blueColor
0.00, 0.00, 1.00
cyanColor
0.00, 1.00, 1.00
yellowColor
1.00, 1.00, 0.00
magentaColor
1.00, 0.00, 1.00
orangeColor
1.00, 0.50, 0.00
purpleColor
0.50, 0.00, 0.50
brownColor
0.60, 0.40, 0.20
clearColor
0.000 [0% alpha]
lightTextColor
1.000 [60% alpha]
darkTextColor
0.000

Undocumented solid colors

tableSeparatorDarkColor
0.66, 0.67, 0.68
tableSeparatorLightColor
0.88, 0.88, 0.88
tableBackgroundColor
1.00, 1.00, 1.00
tableSelectionColor
0.16, 0.43, 0.83
sectionListBorderColor
0.52, 0.56, 0.58 [60% alpha]
sectionHeaderBackgroundColor
0.90, 0.93, 0.99 [80% alpha]
sectionHeaderOpaqueBackgroundColor
0.92, 0.94, 0.99
sectionHeaderBorderColor
0.85, 0.87, 0.91
tableCellBlueTextColor
0.22, 0.33, 0.53
tableCellGrayTextColor
0.50, 0.50, 0.50
textFieldAtomBlueColor
0.16, 0.34, 1.00
textFieldAtomPurpleColor
0.41, 0.00, 0.74
infoTextOverPinStripeTextColor
0.30, 0.34, 0.42

Patterns

UIColorPatterns.png groupTableViewBackgroundColor
viewFlipsideBackgroundColor
underPageBackgroundColor
(Private)

CSS colors

Signature -(NSString*)styleString
Available in 2.0 – 3.1

UIColors can be converted to CSS colors by the -styleString method. For example, [[UIColor lightTextColor] styleString] gives @"rgba(255,255,255,153)".

References