Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to give UILabel a shadow, but it won't show up

I'm trying to give a label in one of the classes in my app a drop shadow, but it's not working at all. Nothing shows up. What am I doing wrong?

// Set label properties
titleLabel.font = [UIFont boldSystemFontOfSize:TITLE_FONT_SIZE];
titleLabel.adjustsFontSizeToFitWidth = NO;
titleLabel.opaque = YES;
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.textColor = titleLabelColor;
titleLabel.shadowColor = [UIColor blackColor];
titleLabel.shadowOffset = CGSizeMake(10, 10);

It's just white, no shadow.

like image 385
Doug Smith Avatar asked May 19 '13 21:05

Doug Smith


1 Answers

Just Add this line to before adding titleLabel to self.view

 titleLabel.layer.masksToBounds = NO;

Good Luck !!

like image 197
Ajay Chaudhary Avatar answered Nov 04 '22 09:11

Ajay Chaudhary