title: Better way to get RGBA Color Components from UIColor?
body: <p>Is there a quicker (or better) way to get the [RGBA] color components from UIColor? There seem to be a lot of variations of this around (some on here, all essentially similar to what I have done here) I am just curious if there is an alternative as it seems a bit "lacking" given that everything else is usually so complete and well thought out.</p>
  
  <pre><code>if([eachKey isEqualToString:@"NSColor"]) {
      UIColor *newColor = [attrs valueForKey:eachKey];
      //NSLog(@"COLOR: %@", newColor);
      CGColorRef colorRef = [newColor CGColor];
      //NSLog(@"%@", colorRef);
      int numComponets = CGColorGetNumberOfComponents(colorRef);
      if(numComponets == 4) {
          const CGFloat *components = CGColorGetComponents(colorRef);
          CGFloat compR = components[0];
          CGFloat compG = components[1];
          CGFloat compB = components[2];
          CGFloat compA = components[3];
  
          //NSLog(@"R:%f G:%f B:%f, A:%f", compR, compG, compB, compA);
      }
  }
  </code></pre>
  
  <p>I am not looking for how (I think I have the long version above) I would just like to know if this is the way your supposed to do this now?</p>