【问题标题】:Uibutton titlelabel shadowoffset property is not behaving properly in ios 7Uibutton titlelabel shadowoffset 属性在 ios 7 中的行为不正确
【发布时间】:2023-12-16 10:06:01
【问题描述】:

我正在使用下面的代码来获得按钮标题标签的阴影。

theCuLabel.titleLabel.shadowColor=[UIColor blackColor];
theCuLabel.titleLabel.shadowOffset=CGSizeMake(-3.0,2.5);

在 IOS 6 中,它可以正常工作,如下所示

但在 IOS 7 中,它无法按预期工作,如下所示

我没有找到解决方案,谁能告诉我解决方案或 IOS 7 中为此发生的任何更新。

在此先感谢...

【问题讨论】:

  • 如果你在 iOS 7 中使用阴影,那你就错了。
  • 嗨,谢谢 4r 的回复,那么如何在 ios 7 中给 uibuttontitle 标签添加阴影,并且应该也支持 4r ios 6&5
  • @WrightsCS 如何在 ios 7+ 中设置文本阴影颜色?

标签: ios ipad uibutton ios7 shadow


【解决方案1】:
[button setTitleShadowColor:[UIColor blackColor] forState:UIControlStateNormal];

这是为 UIButton 设置阴影颜色的正确方法。 我已经尝试过了,并且适用于所有版本。

【讨论】:

  • grt 非常感谢,它现在可以在所有版本中使用...小变化,但 grt
最近更新 更多