gpt4 book ai didi

iOS 设置阴影半径不起作用

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:57:51 30 4
gpt4 key购买 nike

UILabel 设置阴影半径不起作用。

[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];

我的代码(谷歌驱动器) https://drive.google.com/file/d/0B5UPvOBH3cqvOFlvZHhKdlNhb0E/view?usp=sharing

如果这是一个重复的问题,我很抱歉。非常感谢。

最佳答案

因为 [self.testLabel.layer setMasksToBounds:YES];

此方法将使阴影不可见,您可以使用 png/jpg 格式制作阴影图像,并将已设置图像的 ImageView 放在 textLabel 下方以使其工作。

你还应该将不透明度设置为 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];

试试这个..

关于iOS 设置阴影半径不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28445576/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com