-1

I want to make shadow color with #3f51b5.

How can I do that. hope your help. this type cannot use to do that.

cell.layer.shadowColor = [UIColor purpleColor].CGColor;
Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
Marlon Brando aka Ben
  • 863
  • 1
  • 14
  • 33

2 Answers2

0

after setting the color give shadow radius,offset and opacity, convert the color to rgba and use this

  cell.layer.shadowColor = [UIColor colorWithRed:0.2471 green:0.3176 blue:0.7098 alpha:1.0].CGColor;
  cell.layer.shadowRadius=10;
  cell.layer.shadowOffset=CGSizeMake(1, 1);
  cell.layer.shadowOpacity=1;

if you want to use hex color only use this How can I create a UIColor from a hex string?

Community
  • 1
  • 1
Sumit Oberoi
  • 3,455
  • 2
  • 18
  • 18
0

you need to set shadow first

cell.layer.shadowRadius=8;
cell.layer.shadowOffset=CGSizeMake(-1, -1);// this make top left shadow
cell.layer.shadowOpacity=1;
cell.layer.shadowColor = [UIColor colorWithRed:0.2471 green:0.3176 blue:0.7098 alpha:1.0].CGColor;
Tejas Ardeshna
  • 4,343
  • 2
  • 20
  • 39