1

How can I do this behaviour using Objective-C code and not using an image for the drop shadow of this button?

If you look closely you will se that the shadow hasn't the same colour on everywhere , it seems that the black it's more intense near the button and lose alpha as it goes away.

Is there a way? Thanks! enter image description here

Meeshoo
  • 129
  • 11

2 Answers2

3

Try this

self.yourBtn.layer.cornerRadius = 18; // (Height of your Btn /2)
self.yourBtn.layer.shadowColor = [UIColor blackColor].CGColor;
self.yourBtn.layer.shadowOpacity = 0.3;
self.yourBtn.layer.shadowRadius = 8;
self.yourBtn.layer.shadowOffset = CGSizeMake(0.0f,6.0f);
Atanu Mondal
  • 1,714
  • 1
  • 24
  • 30
1

Try This Link

Shadow Of UIButton_Help Link 1

Or

Shadow Of UIButton_Help Link 2

Community
  • 1
  • 1
Shahab Qureshi
  • 952
  • 1
  • 7
  • 19