0

I want to create a rectangular rounded corner button with an inner glow. I hear some recommendations about adding subviews, but i'm worried subviews will cover the text in my button.

How do I achieve inner glow without blocking out the text or background icon image?

John
  • 32,403
  • 80
  • 251
  • 422

2 Answers2

0

Make an image of what you want, then import it into your project. Set the type of your button to custom, and then set the image to the glowing image you made.

Aaron Chapman
  • 44
  • 1
  • 9
0

You can do this(it's not exactly a glow on the button but on the label of the button). The effect is very similar. First

#import <QuartzCore/QuartzCore.h>

and then

UIColor *color = button.currentTitleColor;
theButton.titleLabel.layer.shadowColor = [color CGColor];
theButton.titleLabel.layer.shadowRadius = 4.0f;
theButton.titleLabel.layer.shadowOpacity = .9;
theButton.titleLabel.layer.shadowOffset = CGSizeZero;
theButton.titleLabel.layer.masksToBounds = NO;
self
  • 1,205
  • 1
  • 14
  • 17