iOS - 点击按钮后出现矩形

时间:2017-04-11 13:33:10

标签: ios swift uibutton

我有两个UIButtons,当点击其中一个时,会出现一个奇怪的矩形。我不知道为什么。我将图像设置为按钮上的背景图像,它一直运行到现在。

我现在改变的是我设置了每个按钮isSelected属性,然后我没有 像这样:

thumbsDownButton.isSelected = true 
thumbsUpButton.isSelected = false

enter image description here enter image description here

显然我想要的是让那个矩形消失

3 个答案:

答案 0 :(得分:0)

添加此代码

thumbsDownButton.tintColor = UIColor.white

答案 1 :(得分:0)

您的相框似乎可能以错误的方式计算。 尝试用这个来检查它。

button.clipToBounds = true

请分享更多与初始化和设置视图框架相关的代码。

答案 2 :(得分:0)

样式设置为System。将其设置为Custom修复了问题,矩形不再出现。我从xib设置它(如果它有任何区别)

相关问题