所以我将UILabel.shadowColor设置为非灰色,但阴影始终显示为不透明的50%灰色(或左右)。例如,我尝试将阴影设置为红色,我仍然看到灰色。有没有人见过这个? (这是自定义导航栏后退按钮内的UILabel)
答案 0 :(得分:1)
我在尝试向UIButton
的{{1}}添加非灰色投影时遇到了同样的问题。解决方案似乎是设置按钮的titleLabel
的属性:
layer
button.titleLabel.layer.shadowColor = [UIColor whiteColor].CGColor;
button.titleLabel.layer.shadowOffset = CGSizeMake(0, 1);
button.titleLabel.layer.shadowOpacity = 1;
button.titleLabel.layer.shadowRadius = 0;
是完全显示效果所必需的,因为默认值为3.0(非常模糊),所以必须明确设置shadowOpacity
。
此解决方案需要shadowRadius
。
答案 1 :(得分:0)
你确定你没有把backgroundColor与shadowColor混淆吗?