ios - UIBUtton : what is it and how to remove it? 标题标签上的小黑边

标签 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

最佳答案

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

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

enter image description here

点击Shadow Color并将其更改为Clear Color

enter image description here

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

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

关于ios - UIBUtton : what is it and how to remove it? 标题标签上的小黑边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27419030/

相关文章:

iphone - 将 @selector 传递给我的 UIbutton 但单击事件没有响应

ios - 在 1 个 VC 中按下 UIButton,我需要它将按钮标题保存到不同 View Controller 中的标签,而不是直接相互连接

ios - UITableViewCell 加载图像和重复使用的单元格

iOS ScrollView ,在非事件状态上显示灰度图像,在滚动上显示正常图像

objective-c - 使用 Cocoa Bindings,以编程方式更改 NSTextField 的值不会更新模型

ios - UIAlertView 没有响应

iphone - 如何为 UITable 中的移动行制作自定义按钮和单元格阴影?

objective-c - 使用 xcode 在 ios 中进行引用计数

objective-c - 将 NSData 写入文件?

objective-c - NSButton 切换按钮以编程方式更改