title: unrecognized selector sent to class when trying to create UIColor
body: <p>I'm trying to create a custom color out of a hex color code. I have a seperate class called UIColor+Hex, that takes in a hex string and converts it to a color code and returs a UIColor.</p>
  
  <p>UIColor+Hex.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface UIColor (Hex)
  
  + (UIColor *)colorWithHexString:(NSString *)hex;
  
  @end
  </code></pre>
  
  <p>UIColor+Hex.m</p>
  
  <pre><code>#import "UIColor+Hex.h"
  
  @implementation UIColor (Hex)
  + (UIColor *)colorWithHexString:(NSString *)hex
  {
      if ([hex length]!=6 &amp;&amp; [hex length]!=3)
      {
          return nil;
      }
  
      NSUInteger digits = [hex length]/3;
      CGFloat maxValue = (digits==1)?15.0:255.0;
  
      NSUInteger redHex = 0;
      NSUInteger greenHex = 0;
      NSUInteger blueHex = 0;
  
      sscanf([[hex substringWithRange:NSMakeRange(0, digits)] UTF8String], "%x", &amp;redHex);
      sscanf([[hex substringWithRange:NSMakeRange(digits, digits)] UTF8String], "%x", &amp;greenHex);
      sscanf([[hex substringWithRange:NSMakeRange(2*digits, digits)] UTF8String], "%x", &amp;blueHex);
  
      CGFloat red = redHex/maxValue;
      CGFloat green = greenHex/maxValue;
      CGFloat blue = blueHex/maxValue;
  
      return [UIColor colorWithRed:red green:green blue:blue alpha:1.0];
  }
  
  @end
  </code></pre>
  
  <p>I then have UIColor+Hex.h imported to one of my other classes and make a call to it by: </p>
  
  <pre><code>[self setSelectedfillColor:[UIColor colorWithHexString:@"FF0000"].CGColor];
  </code></pre>
  
  <p>Whenever I hit this code I get this error... </p>
  
  <blockquote>
    <p>'NSInvalidArgumentException', reason: '+[UIColor colorWithHexString:]: unrecognized selector sent to class 0x873d60'</p>
  </blockquote>
  
  <p>I've tried everything I could think of but I still keep getting that error. Anyone have any ideas why this would be happening? </p>