2

I would like to use a an image as the color of an letter-pressed label but something is not working right and I am not sure what. I create the color with

UIImage *redImage = [UIImage imageNamed:@"Red"];
UIColor *redColor = [UIColor colorWithPatternImage:scaledRedImage];

When I create the attributes

NSDictionary *attributes = @{NSForegroundColorAttributeName : redColor, NSTextEffectAttributeName : NSTextEffectLetterpressStyle}; the label is letter-pressed but the color is white.

When using NSDictionary *attributes = @{NSForegroundColorAttributeName : redColor};, the color is set correctly so I know that the color is created correctly.

NSDictionary *attributes = @{NSForegroundColorAttributeName : [UIColor redColor], NSTextEffectAttributeName : NSTextEffectLetterpressStyle}; works perfectly.

So to sum up:

  1. Letterpress + custom color = white letterpressed text
  2. Letterpress + system color = correctly colored and letterpressed text
  3. Custom color + no letterpress = correctly colored

Why is this happening and how can I fix it?

Wain
  • 118,658
  • 15
  • 128
  • 151
Kevin
  • 16,696
  • 7
  • 51
  • 68

0 Answers0