UILabel set shadow radius is not working.
[self.testLabel.layer setShadowColor:[[UIColor purpleColor] CGColor]];
[self.testLabel.layer setShadowOffset:CGSizeMake(3, 3)];
[self.testLabel.layer setShadowRadius:5.0f];
[self.testLabel.layer setMasksToBounds:YES];
My code (Google Drive) https://drive.google.com/file/d/0B5UPvOBH3cqvOFlvZHhKdlNhb0E/view?usp=sharing
I'm sorry if this's a repeat question. Thanks a lot.
because of the [self.testLabel.layer setMasksToBounds:YES];
this method will make the shadow invisible, you can make a shadow image with a png/jpg formate, and put a imageview that had set the image below your textLabel to make it work..
and also you should set the opacity to 1..
// self.testLabel.backgroundColor = [UIColor grayColor];
self.testLabel.layer.shadowOpacity = 1.0f;
[self.testLabel.layer setShadowColor:[[UIColor yellowColor] CGColor]];
[self.testLabel.layer setShadowOffset:CGSizeMake(3, 3)];
[self.testLabel.layer setShadowRadius:5.0f];
// [self.testLabel.layer setMasksToBounds:YES];
try this ..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.