我正在尝试对以编程方式创建的UIButton进行着色:
let button = UIButton( type: UIButtonType.System ) as UIButton
button.frame = CGRectMake( 100, 100, 200, 50 )
button.setTitleColor( MyColours.ORANGE, forState: .Normal )
button.setTitle( "Some Button", forState: UIControlState.Normal )
let backgroundColour = UIColor.blueColor()
button.backgroundColor = backgroundColour
button.titleLabel?.backgroundColor = backgroundColour
myView.addSubview( button )但是,正如你从这张图中看到的,按钮的标签有一个我认为是它自己的背景视图,而不是彩色的。请问我做错了什么?

发布于 2015-11-27 22:40:56
您可以使用button.layer.borderWidth = 0.0;移除按钮的边框
https://stackoverflow.com/questions/33959564
复制相似问题