UIBUtton标题标签上的微小黑色边框:它是什么以及如何删除它?

时间:2014-12-11 09:11:12

标签: ios objective-c uibutton uilabel

问题

标题标签UIBUtton上有一个很小的边框,UILabels不存在。

[self.button setTitle:@"border" forState:UIControlStateNormal] ;
[self.button setTitleColor:[UIColor yellowColor] forState:UIControlStateNormal] ;

self.label.text = @"no borders!"
self.label.textColor = [UIColor yellowColor] ;

由于此边框,带有浅色的UIButton看起来很“脏”。

它是什么以及如何删除它?


图片

enter image description here enter image description here

1 个答案:

答案 0 :(得分:5)

这些是UIButton的标题文字边框阴影。

默认情况下,按钮看起来像深灰色。

enter image description here

点击阴影颜色并将其更改为清除颜色

enter image description here

您也可以使用以下代码以编程方式完成此操作:

 [self.button setTitleShadowColor:[UIColor clearColor] forState:UIControlStateNormal] ;