Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The <strong><code>CIColor</code></strong> class contains color values and the color space for which the color values are valid. </p> <p><a href="https://developer.apple.com/documentation/coreimage/cicolor" rel="nofollow noreferrer">https://developer.apple.com/documentation/coreimage/cicolor</a></p> <pre><code>// UIColor to NSString CGColorRef colorRef = [UIColor grayColor].CGColor; NSString *colorString = [CIColor colorWithCGColor:colorRef].stringRepresentation; </code></pre> <hr> <pre><code>// NSString to UIColor CIColor *coreColor = [CIColor colorWithString:@"0.5 0.5 0.5 1.0"]; UIColor *color = [UIColor colorWithCIColor:coreColor]; </code></pre> <p>-----------------Warning-----------</p> <p>If You Want Support All Devices The Way Mentioned Above to Convert NSString to UIColor Will Not Work On All Devices.</p> <hr> <p><strong>stringRepresentation</strong></p> <p>Returns a formatted string that specifies the components of the color.</p> <p>The string representation always has four components—red, green, blue, and alpha. </p> <p><a href="https://developer.apple.com/documentation/coreimage/cicolor/1437910-stringrepresentation" rel="nofollow noreferrer">https://developer.apple.com/documentation/coreimage/cicolor/1437910-stringrepresentation</a></p> <hr> <p><strong>colorWithString:</strong></p> <p>Creates a color object using the RGBA color component values specified by a string.</p> <p><a href="https://developer.apple.com/documentation/coreimage/cicolor/1438059-colorwithstring" rel="nofollow noreferrer">https://developer.apple.com/documentation/coreimage/cicolor/1438059-colorwithstring</a></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